I am trying to figure out how to use the attached macro to perform a delete/keep body command.
The attached macro from Josh Brady allows the user to select parts and then click ok.
If the user clicks ok I then want it to delete the selected body from the part file.
Set Part = swApp.OpenDoc6(NewFilePath & fileName1 & "_Cyl.SLDPRT", 1, 32, "", errors, longwarnings)
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swSelMgr = swDoc.SelectionManager
BoxReturn = YesBox.GoBox("Please select Cyl body, then press ""OK""", "Need Input", vbOK)
If BoxReturn = vbOK Then
Set Ob = swSelMgr.GetSelectedObject6(1, 0)
Debug.Print "type = " & Ob.GetType
boolstatus = swSelMgr.GetSelectedObject6(1, 0)(, "SOLIDBODY", 0, 0, 0, True, 0, Nothing, 0)
swDoc.FeatureManager.InsertDeleteBody
Dim myFeature As Object
Set myFeature = Part.FeatureManager.InsertDeleteBody2(False)
Else
MsgBox "The user cancelled."
End If
boolstatus = Part.Save3(1, swErrors, swWarnings)
swApp.CloseDoc NewFilePath & fileName1 & "_Cyl.SLDPRT"