Hello,
I'm trying to create a rule in ilogic that would search through all child components (looking for both .ipt and .iam file types) looking for an ilogic rule within each child component with a particular name, and running that rule if it is found. Any ideas as to how I could do this?
Thanks,
Dave
Dave,
try this:
Sub Main auto = iLogicVb.Automation
' Get the active assembly. Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument
' Get all of the referenced documents. Dim oRefDocs As DocumentsEnumerator oRefDocs = oAsmDoc.AllReferencedDocuments
' Iterate through the list of documents. Dim oRefDoc As Document
For Each oRefDoc In oRefDocs
Dim ruleName As String ruleName = "Rule0" Dim rule As Object rule = auto.GetRule(oRefDoc, "Rule0") If (rule Is Nothing) Then 'Call MsgBox("No rule named " & ruleName & " was found in the document.") Else MessageBox.Show(rule.Name, oRefdoc.displayname) Dim i As Integer i = auto.RunRuleDirect(rule) End If
Next End Sub