Determining if a component is a reference

Determining if a component is a reference

dinomyar
Enthusiast Enthusiast
338 Views
4 Replies
Message 1 of 5

Determining if a component is a reference

dinomyar
Enthusiast
Enthusiast

I have an issue where an assembly (A) contains two sub assemblies (B and C).  Sub Assembly B contains 4 parts. Sub Assembly C contains a "reference" to Sub Assembly B for constraint purposes and one other part. 

 

As I traverse the assembly tree, I end up counting the parts in Sub Assembly B twice. How can I tell if a component (B) in the assembly (C) is just a reference and not an actual instance of the component?

 

The BOM shows the correct counts, (5 parts total) so there is something somewhere that tells it that it is a reference only component.

 

I use the following function to get the files in the assemblies.

 

CComQIPtr<DocumentsEnumerator> docsenum;
HRESULT Result = assemblydoc->get_ReferencedFiles(&docsenum);

0 Likes
Accepted solutions (1)
339 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor
Do you need it in I-Logic?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

the information you seek is not stored in the document but in the ComponentOccurnce. (In your case that info is in assembly C)

In iLogic rule you would get this info like this:

Sub Main()

	Dim doc As AssemblyDocument = ThisDoc.Document
	Check(doc)

End Sub

Public Sub Check(doc As AssemblyDocument)
	For Each occ As ComponentOccurrence In doc.ComponentDefinition.Occurrences
		If (occ.Reference) Then
			MsgBox(occ.Name + " is a refrence")
		End If

		Dim refDoc As Document = occ.Definition.Document
		If (refDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject) Then
			Check(refDoc)
		End If
	Next
End Sub

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 5

dinomyar
Enthusiast
Enthusiast

I do not know if I would need it there. The assemblies I am dealing with are from a end user and who knows what they may eventually use.

0 Likes
Message 5 of 5

dinomyar
Enthusiast
Enthusiast

Thank you. I was looping the occurrences to get the quantity counts and just had to add the reference check.

 

 

0 Likes