Hi,
I'm attemping to put together a macro which iterates through each part configuration and then loops through the cut-list in a part file to look within each cut-list item for a variable called 'LENGTH'. If the variable exists, then it will add it to the 'Configuration Specific' properties list (or just print it to the debug console for the time being).
Here's my irrational code thus far:
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim swConfig As SldWorks.Configuration
Dim strValue As String
Dim vConfNameArr As Variant
Dim swConfigName As String
Dim i As Long
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swCustPropMgr = swModel.Extension.CustomPropertyManager(swConfigName)
vConfNameArr = swModel.GetConfigurationNames 'get full list of configurations
For i = 0 To UBound(vConfNameArr) 'Do this for all configurations
swConfigName = vConfNameArr(i)
Do While Not swFeat Is Nothing 'Do this for all cut-list items
Set swCustPropMgr = swFeat.CustomPropertyManager
If swCustPropMgr.Get4 = "LENGTH" Then 'if LENGTH exists then get value
swCustPropMgr.Get4 "LENGTH", False, Empty, strValue
Debug.Print (strValue) 'Print length valuen to console
Exit Do
End If
Set swFeat = swFeat.GetNextFeature
Loop
Next i
End Sub
I'm thinking of a boolean instead of an if statement (at the point highlighted). I know it doesn't make much sense at the moment.
Can someone point me in the right direction?
Cheers,
Ray
SolidworksApi macros