I have a need to programmatically identify the name of the component configuration in use in an assembly. I've spent a day or so without any success and I'm hoping someone will be willing to give me an example.
1. If you want to get a list of every component's in-use config, you need only use the macro called "Run code on every part in assembly" I have on my Macros page. (requires free membership) You will see where it provides sample code that prints config names and also custom properties. If you don't need the latter, just remove that code.
2. If you want to preselect a component, run the macro, and be told what config is in use, you can do that like this:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swComp = swSelMgr.GetSelectedObject6(1, -1)
SolidWorks API Training
In a design table the first column is the configuration name what is the "Link" name so I can put it in my drawing block as $PRPSHEET....???..... etc
Retrieving data ...