AnsweredAssumed Answered

Grab Items from Selection and Rebuild Them

Question asked by Matt Peneguy on Oct 25, 2018
Latest reply on Oct 26, 2018 by Gertjan Van Dijk

So, I'm trying to create a macro to rebuild parts or assemblies I have selected in the Feature Tree.  I've figured out how to iterate through the selected items, but I'm not sure of the code to grab them and rebuild them.  Here's what I have so far:

Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swSelMgr As SldWorks.SelectionMgr
    Dim SelType1 As Long
    Dim i As Integer


    Dim SelCount As Long
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    SelCount = swSelMgr.GetSelectedObjectCount2(-1)
    For i = 1 To SelCount
        
        
        SelType1 = swSelMgr.GetSelectedObjectType3(i, -1)
        MsgBox (SelType1)
        
    Next i
    
End Sub

Outcomes