How to automatically insert virtual components in a part list while inserting a part in an Inventor Assembly

Autodesk Support

Oct 8, 2023


Products and versions covered


Issue:

How to automatically insert virtual components (e.g. Bolts, gaskets, etc.) in a part list while inserting a part in an Inventor Assembly, in a way to have listed the part itself and its related components.

Solution:

  1. Create an Assembly.
  2. Insert the main part into it.
  3. Create all the needed virtual components: About Creating Parts or Virtual Parts in Assemblies
  4. In the assembly, activate the "Parts only" option in the Bill of Materials:
image.png
  1. Now this assembly can be used to replace the main part.​​​​​​​
Note:
If the Part Number or any other iProperty, from the Part, must be used, it can be transferred to the assembly using the following iLogic rule:
 
'''This rule will copy the iProperties from :
'''The first Assembly, if it's an Assembly
'''Or the first derived Part or Assembly, if it's a Part

Dim oRefName As String
If ThisDoc.Document.DocumentType = kAssemblyDocumentObject Then
	'Define assembly document
	Dim oAsmDoc As AssemblyDocument
	oAsmDoc = ThisDoc.Document
	Dim oAsmDef As AssemblyComponentDefinition
	oAsmDef = oAsmDoc.ComponentDefinition
	Dim oAsmRef As ComponentOccurrence
	'Pick the first item
	oAsmRef = oAsmDef.Occurrences.Item(1)
	oRefName = oAsmRef.Name
Else If ThisDoc.Document.DocumentType = kPartDocumentObject Then
	'Define part document
	Dim oPartDoc As PartDocument
	oPartDoc = ThisDoc.Document
	If oPartDoc.ReferencedDocuments.Count = 0 Then Return
	Dim oDerivedRef As Inventor.Document
	'Pick the first derived document
	oDerivedRef = oPartDoc.ReferencedDocuments(1)
	oRefName = oDerivedRef.DisplayName
Else
	Return
End If

iProperties.Value("Project", "Part Number") = iProperties.Value(oRefName, "Project", "Part Number")

​​​​​​​

Products:

Inventor;


Was this information helpful?


Need help? Ask the Autodesk Assistant!

The Assistant can help you find answers or contact an agent.


What level of support do you have?

Different subscription plans provide distinct categories of support. Find out the level of support for your plan.

View levels of support