Good morning!
Can someone give me an idea or code example of how in .iam create a virtual part and save it separately in specific folder?
Any help is appreciated.
Thank you.
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
Solved by alewer. Go to Solution.
This will create a virtual component:
Public Sub AddVirtual() Dim oAssemblyDoc As Inventor.AssemblyDocument Set oAssemblyDoc = ThisApplication.ActiveDocument Dim oCompDef As Inventor.ComponentDefinition Set oCompDef = oAssemblyDoc.ComponentDefinition Dim oPosition As Inventor.Matrix Set oPosition = ThisApplication.TransientGeometry.CreateMatrix() Dim oVirtual As ComponentOccurrence Set oVirtual = oAssemblyDoc.ComponentDefinition.Occurrences.AddVirtual("TEST", oPosition) End Sub
Can you elaborate on your save requirement? Virtual parts can't be saved. Or do you wish to save the assembly?
What we have is the switch drawing with iLogic code, that changes the parameters and description only, model stays intact. Then we save it as new #.idw. Now we have to place switch model in the main assembly model. Thats why I was thinking to add a code to an existing drawing to create a virtual part and save it.
I guess I can modify master switch model and save it as new part # instead virtual part.
Thank you.
The previous answer is correct. Virtual parts only exist in the context of an assembly and are intended to represent items that aren't shown graphically but you still want them listed in the BOM.