Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Macro to delete a group in a structural member

Status
Not open for further replies.

fifiririloulou

Agricultural
Apr 8, 2008
33
0
0
CA
Hi everyone,
I have a welded part with a "Structural Member1" that contains 2 groups of 2 segments each, and
I would like to delete/remove one of the group. (and/or remove one segment in one of the groups)

I have found one macro to create a weldment, and one to modify the profil, but none for that. Anyone has an idea?

So far I have this macro that gives me the number of groups and their number of segments:

Code:
Dim swApp As Object
Dim swPart As Object
Dim boolstatus As Boolean
Dim swWeldFeat As Feature
Dim swWeldFeatData As StructuralMemberFeatureData
Dim group As StructuralMemberGroup
Dim vgroups As Variant

Sub main()
Set swApp = Application.SldWorks
Set swPart = swApp.ActiveDoc

boolstatus = swPart.Extension.SelectByID2("Structural Member1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Set swWeldFeat = swPart.SelectionManager.GetSelectedObject6(1, 0)
Set swWeldFeatData = swWeldFeat.GetDefinition

boolstatus = swWeldFeatData.AccessSelections(swPart, Nothing)

Debug.Print swWeldFeatData.GetGroupsCount()
vgroups = swWeldFeatData.Groups

Set group = vgroups(0)
Debug.Print group.GetSegmentsCount

Set group = vgroups(1)
Debug.Print group.GetSegmentsCount

boolstatus = swWeldFeat.ModifyDefinition(swWeldFeatData, swPart, Nothing)

End Sub
 
Status
Not open for further replies.
Back
Top