Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to model a wire mesh basket? 2

Status
Not open for further replies.

jackk

Mechanical
Nov 22, 2002
1,306
US
I'm stumped and need some help. I'd like to create a 3D model of a simple basket made from hardware cloth (wire mesh). The basket has a 6 inch diam (or hex shaped) bottom with sides that come up about 1 inch. I'm looking for a clever way to model the wires on the side with the bend on the bottom, so I don't have to model each wire individually.

I can easily create the bottom wire mesh with a rectangular pattern. But then what?

Another approach is to create all the wire centerlines by intersecting a series of offset planes with a revolved surface, but how do I add ribs to each centerline?

A powercopy would work, but I think I'd have to run it for each wire.

Anyone have some ideas on how to do this?
 
Replies continue below

Recommended for you

Code:
Sub CATMain()

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim partDocument1 As Document
Set partDocument1 = documents1.Add("Part")

Dim part1 As Part
Set part1 = partDocument1.Part

Dim bodies1 As Bodies
Set bodies1 = part1.Bodies

Dim body1 As Body
Set body1 = bodies1.Item("PartBody")




R = 5
h = 5
R1 = 1.5
WD = 0.125
SptRad = (WD / 2) * 25.4
Sep = 0.25

Dim oRelations As Relations
Set oRelations = part1.Relations

For j = 0 To WD Step WD

Set HSF = part1.HybridShapeFactory

Set P0 = HSF.AddNewPointCoord(0, 0, 0 - j)
Set P1 = HSF.AddNewPointCoord(R + j, 0, 0 - j)
Set P2 = HSF.AddNewPointCoord(R + j, 0, h)


'part1.Update




Set hybridShapePolyline1 = HSF.AddNewPolyline()
Set hybridBodies1 = part1.HybridBodies

Set hybridBody1 = hybridBodies1.Add()
'hybridBody1.Name = "Geometrical Set." & j
Set hybridShapes1 = hybridBody1.HybridShapes

part1.InWorkObject = hybridShapes1

Set hybridShapePointCoord1 = P0
Set Reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
hybridShapePolyline1.InsertElement Reference1, 1

Set hybridShapePointCoord2 = P1
Set Reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord2)
hybridShapePolyline1.InsertElement Reference2, 2

Set hybridShapePointCoord3 = P2
Set reference3 = part1.CreateReferenceFromObject(hybridShapePointCoord3)
hybridShapePolyline1.InsertElement reference3, 3

If j = 0 Then
hybridShapePolyline1.SetRadius 2, R1
Else
hybridShapePolyline1.SetRadius 2, R2
End If


Dim oRefPolyLineElement As Reference
Dim oElementRadius As Length

hybridShapePolyline1.GetElement 2, oRefPolyLineElement, oElementRadius


hybridShapePolyline1.Closure = False


hybridBody1.AppendHybridShape hybridShapePolyline1
part1.InWorkObject = hybridShapePolyline1
'part1.Update



Dim Par3 As RealParam
If j = 0 Then

Dim Par0 As RealParam
Set Par0 = part1.Parameters.CreateReal("WD", WD)

Dim Par1 As RealParam
Set Par1 = part1.Parameters.CreateReal("R", R)

Dim Par2 As RealParam
Set Par2 = part1.Parameters.CreateReal("H", h)


Set Par3 = part1.Parameters.CreateReal("R1", R1)

Else

'Set Par3 = part1.Parameters.CreateReal("R2", R1 + WD)
End If



Dim oX
Set oX = P1.X

Dim oX1
Set oX1 = P2.X
 
Dim oZ
Set oZ = P2.Z

Dim oZ1
Set oZ1 = P1.Z

Dim oZ2
Set oZ2 = P0.Z



If j = 0 Then
Dim oFormula1 As Formula
Set oFormula1 = oRelations.CreateFormula("Diametro" & j, "Diametro Total", oX, "R*1in")

Dim oFormula2 As Formula
Set oFormula2 = oRelations.CreateFormula("Diam" & j, "Altura", oX1, "R*1in")

Dim oFormula3 As Formula
Set oFormula3 = oRelations.CreateFormula("Altura" & j, "Altura", oZ, "H*1in")

Dim oFormula4 As Formula
Set oFormula4 = oRelations.CreateFormula("Radio", "Radio", oElementRadius, "R1*1in")

Else


Set oFormula1 = oRelations.CreateFormula("Diametro" & j, "Diametro Total", oX, "(R+WD)*1in")


Set oFormula2 = oRelations.CreateFormula("Diam" & j, "Altura", oX1, "(R+WD)*1in")


Set oFormula3 = oRelations.CreateFormula("Altura" & j, "Altura", oZ, "H*1in")


Set oFormula4 = oRelations.CreateFormula("Radio", "Radio", oElementRadius, "(R1+WD)*1in")

Set oFormula5 = oRelations.CreateFormula("Altura" & j, "Altura", oZ1, "WD*-1in")

Set oFormula6 = oRelations.CreateFormula("Altura" & j, "Altura", oZ2, "WD*-1in")

End If


'part1.Update

If j = 0 Then
Set P3 = HSF.AddNewPointCoord(0, 0, 1)

Dim Reference4 As Reference
Set Reference4 = part1.CreateReferenceFromGeometry(P3)

Dim Linea
Set Linea = HSF.AddNewLinePtPt(Reference1, Reference4)
Dim Reference6 As Reference
Set Reference6 = part1.CreateReferenceFromGeometry(Linea)
Else
End If


Dim Reference5 As Reference
Set Reference5 = part1.CreateReferenceFromGeometry(hybridShapePolyline1)



Dim Surf  'As HybridShapeRevol
Set Surf = HSF.AddNewRevol(Reference5, 360, 0, Reference6)
hybridBody1.AppendHybridShape Surf
'part1.Update



Dim Reference7 As Reference
If j = 0 Then
Set ZXPlane = part1.OriginElements.PlaneZX
Set Reference7 = part1.CreateReferenceFromGeometry(ZXPlane)
Else
Set YZPlane = part1.OriginElements.PlaneYZ
Set Reference7 = part1.CreateReferenceFromGeometry(YZPlane)
End If


Dim Reference8 As Reference
Set Reference8 = part1.CreateReferenceFromGeometry(Surf)


joe = Sep

For i = joe / 2 To R Step joe
Set Pln = HSF.AddNewPlaneOffset(Reference7, i * 25.4, 1)

Dim Reference9 As Reference
Set Reference9 = part1.CreateReferenceFromGeometry(Pln)

Set Inter = HSF.AddNewIntersection(Reference9, Reference8)
Inter.ExtendMode = 3
hybridBody1.AppendHybridShape Inter
'Document.Part.UpdateObject Inter
'HSF.GSMVisibility Inter, 0
Dim Reference10 As Reference
Set Reference10 = part1.CreateReferenceFromGeometry(Inter)

Dim Swpt
Set Swpt = HSF.AddNewSweepCircle(Reference10)
Swpt.Mode = 6
Swpt.SetRadius 0, SptRad
hybridBody1.AppendHybridShape Swpt

Dim Reference11 As Reference
Set Reference11 = part1.CreateReferenceFromGeometry(Swpt)

If j = 0 Then
part1.InWorkObject = body1
Else
part1.InWorkObject = body2
End If


Set SF = part1.ShapeFactory
Set Clo = SF.AddNewCloseSurface(Reference11)

Next i
Set Mi = SF.AddNewMirror(Reference7)

If j = 0 Then
Set bodies2 = part1.Bodies


Set body2 = part1.Bodies.Add()

'Set body1 = bodies2.Item("PartBody")

part1.InWorkObject = body2
Else
End If
Next j
part1.Update


 End Sub


This is my intent....

and my Result....
 
 http://files.engineering.com/getfile.aspx?folder=f32217e8-730e-42b6-9dc2-a1dc47832423&file=Untitled.png
Thank you Alex. Nice job, and proof again that macros are a very powerful modeling tools!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top