Hi everyone
I created this code in order to display the perimeter and bends in each configuration but not work properly...
How can I modify this code so that my perimeter and bends display in every configuration ?
Moreover, how could I change so I subscribe to perimeter values and bends when i run the macro again and again???
for example now i have Bends = 3..... I modify the part and now have 5 bends, and i want to run a macro again to update properties to appear Bends = 5
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeature As SldWorks.Feature
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim Prop1 As String
Dim Prop2 As String
Dim Perimeter As String
Dim Bends As String
Dim vConfNameArr As Variant
Dim sConfigName As String
Dim i As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeature = swModel.FirstFeature
While Not swFeature Is Nothing
If swFeature.GetTypeName = "CutListFolder" Then
Set swCustPropMgr = swFeature.CustomPropertyManager
swCustPropMgr.Get4 "Cutting Length-Outer", True, 0, Perimeter
swCustPropMgr.Get4 "Bends", True, 0, Bends
Prop1 = Perimeter
Prop2 = Bends
'Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")
Debug.Print Prop1
Debug.Print Prop2
vConfNameArr = swModel.GetConfigurationNames
For i = 0 To UBound(vConfNameArr)
sConfigName = vConfNameArr(i)
swModel.AddCustomInfo3 sConfigName, "Perimeter", swCustomInfoText, Prop1
swModel.AddCustomInfo3 sConfigName, "Bends", swCustomInfoText, Prop2
Next i
End
End If
Set swFeature = swFeature.GetNextFeature
Wend
End Sub
SolidworksApi macros