AnsweredAssumed Answered

How to pattern Virtual parts?

Question asked by Sanya Shmidt on Sep 30, 2014
Latest reply on Nov 20, 2014 by Sanya Shmidt

Hello guys!

I`m just curious if anyone did that already and can help me with the code. The script below is for adding one instance of the virtual part into the assembly.


                    swModel = swApp.ActiveDoc

                    swSelMgr = swModel.SelectionManager

                    If swModel.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0) = False Then

                        Debug.Print("Failed to select Front plane; check feature name.")

                        Exit Sub

                     End If


                    swPlaneFeature = swSelMgr.GetSelectedObject6(1, -1)

                    swPlane = swPlaneFeature.GetSpecificFeature2

                    swAssem = swModel


                    lResult = swAssem.InsertNewVirtualPart(swPlane, swVirtComp)

                    swVirtComp.Name2 = sVirtPart


What if I need to add 20 items? How should I approach?


The other question I have : How to properly change custom properties of the newly added Virtual part?


I`m doing the following, but its not working...


' selecting virtual component

boolstatus = swModel.Extension.SelectByID2(swVirtComp.Name2 & "@" & swModel.GetTitle, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)


swSelMgr = swModel.SelectionManager

swComp = swSelMgr.GetSelectedObjectsComponent2(1)

swCompModel = swComp.GetModelDoc

swCompModel.CustomInfo2(swCompModel.GetActiveConfiguration.Name, "Description") = "New VALUE"



Thank you