I wrote a macro to select a component by name from an assembly and then change its dimensions as required to automate the process.
Since I used dimension names, this script cannot be currently used for other similar assemblies.
My question is, how can I get all the dimensions of the selected component in the assembly file.
Including a part of my code here:
----------------------------------------------------------------------------------------------------------------------------------------------------
Dim vComponents As Variant
Dim vComp As Variant
Dim Part As Object
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
vComponents = Part.GetComponents(True)
For Each vComp In vComponents
Set swComp = vComp
If InStr(swComp.Name2, "_ST_") > 0 Then swComp.Select4 True, Nothing, False
Next
Set swSelMgr = Part.SelectionManager
Set swSelComp = swSelMgr.GetSelectedObjectsComponent4(1, -1)
Set swReferenceModel = swSelComp.GetModelDoc2
originalStello = swReferenceModel.Parameter("D7@Schizzo1").Value // this is where I am hard coding the name
----------------------------------------------------------------------------------------------------------------------------------------------------
In the last line, you can see that I am getting the dimension value by hard coding its name. I would rather like to get all dimensions of the SELECTED component and then write logic to get a particular dimension from that list.
I started working with Solidworks API 2 days ago. Please help!