Assembly within assembly Detection

Assembly within assembly Detection

Anonymous
Not applicable
659 Views
4 Replies
Message 1 of 5

Assembly within assembly Detection

Anonymous
Not applicable

I would like to see if there is a routine that allows my iLogic code to detect if my assembly contains another assembly within it. If my assebly contains assemblies then I don't want "MyRule" to run. Else if it does then I want "MyRule" to run.

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

Anonymous
Not applicable

Write a function that returns a boolean.

 

in the function loop through the top level document's referencedDocuments property.

If any end in ".iam" stop looping and return a true.other wise return a false.

 

If you need to check part files as well then you will need to check each part files referencedDocuments Count property.  If it is > 0 then return true otherwise false.

0 Likes
Message 3 of 5

jdkriek
Advisor
Advisor
Accepted solution

Something like this:

 

Dim oDoc As Document = ThisDoc.Document
Dim oRefDoc As Document
Dim AsmFound As Boolean
For Each oRefDoc In oDoc.AllReferencedDocuments
	If oRefDoc.DocumentType = kAssemblyDocumentObject Then
		AsmFound = True
		Exit For
	End If
Next
If AsmFound = False Then
	iLogicVb.RunRule("MyRule")
End If
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 4 of 5

Anonymous
Not applicable

Actually Jonathon He only needs to check the references under the top level, not the all the referenced in his assembly.  That is why I suggested ReferencedDocument instead of AllReferencedDocuments.

 

Just as you are using an If..Exit in your loop when there is no point in continuing further.

Message 5 of 5

Anonymous
Not applicable

Thanks that worked out great

0 Likes