8 Replies Latest reply on Apr 9, 2017 9:39 AM by Deepak Gupta

    AddCompoment5: question to configuration and virtual part.

    Ross John

      Hello Forum,

       

      I am following the example to add a part into an assembly and then mate them. 2017 SOLIDWORKS API Help - Add and Mate Component Example (VB.NET)

       

      I actually want to add a specific configuration of the compoment. Lets say I already have a configuration in the part called "Confi_A". I rewrite the sample code as follows...

      swComponent = swAssemblyDoc.AddComponent5(strCompModelname, swAddComponentConfigOptions_e.swAddComponentConfigOptions_CurrentSelectedConfig, "", True, "Confi_A", 0, 0, 0)

       

      ' Make the component virtual

      stat = swComponent.MakeVirtual2(False)

       

      My problem and question 1: The part was added, but the desired configuration "Confi_A" was not activated. Have I done wrong in the code?

      My problem and question 2: It seems that the added part is in virtual status, because in the assembly tree the added part is shown with square brackets. How to add the part NOT as a virtual component?

       

      Any help will be highly appreciated. Thanks!