Hello Friends,
I have a macro that gets properties of configurations with a combo box. Half of it works very well except I can't get the resolved value of properties getting other properties with \$PRP.
I'm on SW2009 SP5 so I can't use get4.
Also, I was able to get it to work with configuration.show but I'm afraid that it would make complicated parts take a while to process.
In the attached files i have 3 properties. Plasma combines DrawingNo with Detail.
But in my macro's userform the textbox should switch from P11512AA-A to P11512BB-B.
Please take a look at my code and help me.
I attached the part and macro files. Run the macro "Main".
'********************************************************************************************
Option Explicit
Dim swApp As Object
Dim SWcustPropManager As SldWorks.CustomPropertyManager
Dim SWdocument As ModelDoc2
Sub main()
Dim ConfigArray() As String
Dim SelectedConfig As String
Set swApp = Application.SldWorks
Set SWdocument = swApp.ActiveDoc
ReDim ConfigArray(SWdocument.GetConfigurationCount - 1)
ConfigArray = SWdocument.GetConfigurationNames
Dim x As Integer
For x = 0 To UBound(ConfigArray)
UserForm1.ComboBox1.AddItem ConfigArray(x)
Next x
UserForm1.ComboBox1.Text = SWdocument.ConfigurationManager.ActiveConfiguration.Name
GetAllProps
UserForm1.Show
End Sub
Sub GetAllProps()
Dim value As Boolean
Dim ValOut1 As String
Dim ReolvedValOut1 As String
Dim ValOut2 As String
Dim ReolvedValOut2 As String
Set SWcustPropManager = SWdocument.Extension.CustomPropertyManager(UserForm1.ComboBox1.Text)
value = SWcustPropManager.Get3("Plasma", False, ValOut1, ReolvedValOut1)
UserForm1.TextBox1valout.Text = ValOut1
UserForm1.TextBox1resolved.Text = ReolvedValOut1
value = SWcustPropManager.Get3("Detail", False, ValOut2, ReolvedValOut2)
UserForm1.TextBox2valout.Text = ValOut2
UserForm1.TextBox2resolved.Text = ReolvedValOut2
End Sub
'********************************************************************************************
SolidworksApi macros