How to change configurations in solidworks assembly using vb.net or c# api
To switch assembly configuration use IModelDoc2::ShowConfiguration2, to change component’s configuration use IComponent2::ReferencedConfiguration
For part level, it's different than the assembly level.
Assembly LevelDim instance As IComponent2Dim value As StringiModeldoc.extension.selectedbyID2instance = iModelDoc.SelectionManager.GetSelectedObjectsComponent4(1, -1) instance.ReferencedConfiguration = "Your Config" iModelDoc.EditRebuild3() It took me 2 weeks to figure it out. It's different from regular solidworks VBA.
Thank you Ly Nguyen, for doing your hard work,
I have done a copy paste it above code, while code is running error, can you please check it and can you please send to me VB.net file and solid works file for reference purpose if it possible.
Copying straight like that won't work if you know enough coding in this field. Please check with selectedbyID2 concept by recording the macro. Select a component/part and change its configuration and rebuild it. It will show you what selectedbyID2 means. Also, your config is what appears on your the real configuration. I am not sure what you are working with so I can't give you the exact command code. Thank you.
Thank you @Ly Nguyen
Retrieving data ...