i have attached reference image
solidworks api helpadvanced api
Record your solidworks VBA and show the code for changing configuration in assembly as picture shown. I can write it in VB.net.
Dim swApp As Object
Dim Part As ObjectDim boolstatus As BooleanDim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDocboolstatus = Part.Extension.SelectByID2("Part1-1@1AAS", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
' Component Configuration (Flyout Menu)Dim swComp As Component2Set swComp = Part.SelectionManager.GetSelectedObjectsComponent4(1, -1)swComp.ReferencedConfiguration = "1A"boolstatus = Part.EditRebuild3()boolstatus = Part.ShowConfiguration2("1A")End Sub
I have attached Image and code as same, please have a look it.
Dim swComp as Component2Dim swModel as ModelDoc2swModel.Extension.SelectByID2("Part1-1@1AAS", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)swComp = swModel.SelectionManager.GetSelectedObjectsComponent4(1, -1)swComp.ReferencedConfiguration = "1A" swModel.EditRebuild3()
I am assuming you know the code to start up the solidworks and open the parts and everything else as I hope this is probably the middle piece of the puzzle you are looking for.
Thank you sir,
while code is running i am getting error, i have attached same.
I see the problem. You need to move the Dim swModel above the swApplication and put swModel = swApplication.OpenDoc. It should work now.
i have changed the location Dim swmodel, i am getting same issue
You didn't do it right.
It was supposed to be
swModel = swApplication.opendoc(.....)
In Solidworks VB.net you can't just partially open the part first and get the visual basic coding to magically work it out like. It has to go through from the beginning until the end, no middle ground.
Retrieving data ...