Macro creation derived configuration

Hello everyone,
I have a macro that allows me to create named configurations according to a procedure (01,02,03,...,xx).
I would like to be able to have a macro that allows you to create a configuration derived (sub-configuration) from a specific existing configuration (xx).
Does anyone have a solution, because after several tries, I get stuck.
Thanks in advance

Hello
With addconfiguration2 from iconfigurationmanager, you just have to specify the name of the parent configuration in the "parentconfigname" parameter

2 Likes

Hello Lynkoa15,

Thank you for your answer.
On the other hand, I don't understand how you do this (macro novice...).
Below is an example of a config creation macro that I use. What do I need to add to create my sub-configuration? :

Sub main()

Set swApp = _
Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.AddConfiguration2("02", "", "", False, False, False, True, 256)
boolstatus = Part.AddConfiguration2("03", "", "", False, False, False, True, 256)
boolstatus = Part.AddConfiguration2("05", "", "", False, False, False, True, 256)
boolstatus = Part.AddConfiguration2("14", "", "", False, False, False, True, 256)
boolstatus = Part.AddConfiguration2("17", "", "", False, False, False, True, 256)
boolstatus = Part.AddConfiguration2("xx", "", ", "", False, False, False, True, 256)
End Sub

If you look in the API the solution of @Lynkoa15 is the baone:
https://help.solidworks.com/2020/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IConfigurationManager~AddConfiguration2.html
And the example given in the API:
https://help.solidworks.com/2020/English/api/sldworksapi/Work_with_Configurations_Example_VB.htm
To be more precise, here is the place where you specified, the name of your configuration that you want to derive:


If necessary, retrieve the name of the active configuration:
Model. GetActiveConfiguration

3 Likes

Thank you very much

the macro works and I'll go to bed less stupid tonight :+1:

Have a nice day