Hello
Finally, I add conditions to renaming parts based on a configuration property that SWOOD creates.
I have sketched out a macro, but I have trouble understanding correctly how the dialogue with solidworks works.
I manage to get all the different children that my assembly has.
Now I would like to succeed in verifying that a property is beautiful and exists in each of them, if so I rename it if not, I move on to the next one.
Can you help me? I'm posting the beginning of my code.
Thank you in advance, have a good day.
Dim swApp As Object
Explicit Option
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim swAssy As ModelDoc2
Dim swModelDocExt As ModelDocExtension
Dim swCustProp As CustomPropertyManager
Dim val As String
Dim valout As String
Dim bool As Boolean
Dim Wood As String
Dim Name() As String
Dim list As String
Dim retval() As String
Dim Text As String
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
If swModel.GetType = swDocASSEMBLY Then
retval = swModel.GetDependencies2(False, False, False)
ReDim name(1 TB ((UBound(retval) - 1) / 2) + 1)
For i = 0 TB (UBound(retval) - 1) / 2
Set swModelDocExt = swModel.Extension
Set swCustProp = swModelDocExt.CustomPropertyManager("")
bool = swCustProp.Get4("SWOODCP_PanelStockLength", True, val, valout)
Debug.Print "Value: " & val
Debug.Print "Evaluated value: " & valout
Debug.Print "Up-to-date data: " & bool
text = text & retval(2 * i) & vbCr
Next i
End If
MsgBox (text)
End Sub