Marco Bolzon

get config part inserted into a part

Discussion created by Marco Bolzon on Jan 22, 2021
Latest reply on Jan 23, 2021 by Marco Bolzon

Hallo!
I have e particular question. I didn't find help on the web.
I have a part with some configurations (Part_01).
Now I insert this part into a new part (Part_02).
I need the VBA code to extract the name of active configuration of Part_01 used in Part_02.
I know, and it works, the code to extract the name of active configuration of a part into an assembly.

...
Dim swComp As Component2
'strtemp1 is the correct string to select the part into assembly
...
bool = Modello.Extension.SelectByID2(strtemp1, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Set swComp = swSelMgr.GetSelectedObject6(1, -1)
ComboBox1.Text = swComp.ReferencedConfiguration
...


I was hoping the code would look similar when working on a body with configurations, but no!

...
Dim swCompFeature As Feature
'strtemp1 is the correct string to select the body into part
...
bool = Modello.Extension.SelectByID2(strtemp1, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Set swCompFeature = swSelMgr.GetSelectedObject6(1, -1)
ComboBox1.Text = swCompFeature.ReferencedConfiguration
...

The last line of the code is incorrect. Probably the "ReferencedConfiguration" is not usable whit a BODYFEATURE.

I thank those who can help me!
Marco

Outcomes