Hello guys,
On my Solidworks 2017 sp4 version i'm running a macro to automattically create/fill a cutlist with my own property names for sheet metal body's.
Now i've got a problem with this macro.
When i'm running this macro for a PART with multiple body's (sheet metal, weldments and extrudes) it's it's also changing the custom property's for my weldment files.
Is there anyone right here who can add an exeption to this macro? something like only change 'sheet metal' cutlist items?
The macro:
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
' Get the DeleteFace feature
Set swFeat = swModel.FirstFeature
Do While Not swFeat Is Nothing
If swFeat Is Nothing Then
Exit Do
End If
featureName = swFeat.Name
If swFeat.GetTypeName2 = "CutListFolder" Then
boolstatus = swModelDocExt.SelectByID2(featureName, "SUBWELDFOLDER", 0, 0, 0, False, 0, Nothing, 0)
swModelDocExt.Create3DBoundingBox
Set swCustPropMgr = swFeat.CustomPropertyManager
swCustPropMgr.Add3 "Afmeting", swCustomInfoType_e.swCustomInfoText, """SW-3D-Bounding Box Width@@@" & swFeat.Name & "@" & FileName & ".SLDPRT""" & " x """ & "SW-3D-Bounding Box Length@@@" & swFeat.Name & "@" & FileName & ".SLDPRT""mm", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd
Set swCustPropMgr = swFeat.CustomPropertyManager
swCustPropMgr.Add3 "Benaming", swCustomInfoType_e.swCustomInfoText, "Plaat ""SW-Sheet Metal Thickness@@@" & swFeat.Name & "@" & FileName & ".SLDPRT""mm", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd
Set swCustPropMgr = swFeat.CustomPropertyManager
swCustPropMgr.Add3 "Materiaal", swCustomInfoType_e.swCustomInfoText, """SW-Material@@@" & swFeat.Name & "@" & FileName & ".SLDPRT""", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd
Set swCustPropMgr = swFeat.CustomPropertyManager
swCustPropMgr.Add3 "Opmerking", swCustomInfoType_e.swCustomInfoText, """", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd
End If
Debug.Print swFeat.GetTypeName2
Set swFeat = swFeat.GetNextFeature
Loop
MsgBox "Done setting Afmeting, Benaming, Materiaal, Opmerking property"
End Sub
Only a weldment works fine (no macro needed for the right custom propertys)
after adding a sheet metal body and running the macro, the custom propertys of the sheet metal are fine
but it also changed the weldment's custom properties by adding a bounding box.
I hope someone can help me changing this macro, i'm a leek with macro's!
Kind regards,
Biko
SolidworksApi macros