Hi,
first about the issue.
Our company bought pipe bend machine, on which bends can be programed. Worst thing for us is how it must be done. Program for the machine can be created only on the centerline of the pipe and that centerline must be exported to iges format. It can be fine, if our production will be at least 100 parts for one program. But... we need mostly 1-2 equal bended pipes for one program, and such pipes count is hundreds.
Sample of pipe which usually we need to bend.
Main idea is:
1) create 3DSketch from straight lines on pipe centerline,
2) give that 3DSketh specific name,
3) copy that sketch (Ctrl+C)
4) Create new model document and paste 3DSkech
5) Export new document to iges.
All those steps must be done with VB.Net add-in (Programmatically)
I don't have any problems write code for steps 2,3,4,5. But I don't have any ideas how to do step 1. Anyone can give me idea possible solution?
SolidworksApi/macros
How this pipe geometry was generated? Usually to create this geometry in SOLIDWORKS you will be using weldment or sweep which would have centerline as a base sketch? Did you import this from other software as foreign format?
What i have already did with Vb.net
Public Sub MainTest()
Dim Part, Part2 As ModelDoc2
Dim FeatMgr As FeatureManager
Dim SelMgr As SelectionMgr
Dim swWeldFeat As Feature
Dim swWeldFeatData As StructuralMemberFeatureData
Part = SwApp.ActiveDoc
FeatMgr = Part.FeatureManager
SelMgr = Part.SelectionManager
Dim Group As StructuralMemberGroup
Dim vGroups As Object
Dim vSegments As Object
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' get path of weldment and copy
swWeldFeat = SelMgr.GetSelectedObject6(1, 0)
swWeldFeatData = swWeldFeat.GetDefinition
swWeldFeatData.AccessSelections(Part, Nothing)
Debug.Print("")
Debug.Print("Groups Count : " & swWeldFeatData.GetGroupsCount)
Debug.Print(" Feature Name : " & swWeldFeat.Name)
vGroups = swWeldFeatData.Groups
Dim i As Long, j As Long
For i = LBound(vGroups) To UBound(vGroups)
Group = vGroups(i)
Debug.Print(" Segment Count in Group " & i + 1 & " : " & Group.GetSegmentsCount)
Debug.Print(" Rotational angle for group: " + Group.Angle.ToString())
vSegments = Group.Segments
For j = LBound(vSegments) To UBound(vSegments)
vSegments(j).Select(True)
Next j
Next i
Part.EditCopy()
'paste to new part
swWeldFeatData.ReleaseSelectionAccess()
Dim Template As String
Template = SwApp.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swDefaultTemplatePart)
Part2 = SwApp.NewDocument(Template, 0, 0, 0)
Part2.Paste()
End Sub
Something like this but straight lines only. Moreover, those straight lines must be connected by the end points. After that only that sketch must be exported to iges, becouse other way solidworks exports all sketches in current model. What i want before export is in the attached file.
I think, i need to play with coordinates of the end points, but before that need to delete all sketch segments which are not lines. More to Also, there can be more than one weldment feature in the model.
Thank you. But you already have a 3D sketch of centerline in there, can't you just use it?
It is weldment profile. I have attached sample model to this reply.