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.
Solved! Go to Solution.
Solved by jdkriek. Go to Solution.
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.
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
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.