<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Run ilogic rule to all part in the assembly in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508723#M76308</link>
    <description>&lt;P&gt;I agree with both of your statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But considering my inexperience, I'm trying to keep this simple for now - An assembly file with just one part in it. no recursion. Inefficient code for the sake of simplicity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having said that, can you comment on why this code is not doing what I want it to do? which is make the iProperties descriptions equal the part number and then delete the part numbers in both the assembly instance and the part instance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Nov 2017 17:04:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-01T17:04:15Z</dc:date>
    <item>
      <title>Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/5455143#M53380</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one question how to run ilogic rule to all part in assembly? Mean when your run the rule in assembly environment the rule will automatically go to each part in the assembly. not need to open one by one for run the rule.&lt;/P&gt;&lt;P&gt;Any update very appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Zaidi&lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2014 10:25:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/5455143#M53380</guid>
      <dc:creator>zaidi_drafter</dc:creator>
      <dc:date>2014-12-30T10:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/5482595#M53770</link>
      <description>&lt;P&gt;Zaidi,&lt;/P&gt;
&lt;P&gt;I am not much good at writing iLogic, but as far as implementing the rules, if you copy the rule from your part into the "Edit Rule" dialog&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/150543i5CC0613D5A8B00E2/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="rule.JPG" title="rule.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;Then just have the iLogic browser open in your regular browser&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/150545i427999FF54D7B2DD/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="rule.JPG" title="rule.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;It will always be there to run in your assembly.&amp;nbsp; I would setup this arrangement in your part as well as your assembly templates so every new part or assembly model you create will have this there for oyu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/48465i2E30A1CFF7AEBBA1/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="check.PNG" title="check.PNG" align="center" /&gt;&lt;FONT face="comic sans ms,sans-serif" size="1"&gt;&lt;EM&gt;&lt;STRONG&gt;If this solved your issue please&lt;/STRONG&gt; &lt;STRONG&gt;mark this&amp;nbsp;posting "Accept as Solution".&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="comic sans ms,sans-serif" size="1"&gt;&lt;EM&gt;Or if&amp;nbsp;you like something that was said&amp;nbsp;and it was helpful, Kudos&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/48467i709D60FDB53FB7DA/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="kudos.PNG" title="kudos.PNG" align="center" /&gt;&amp;nbsp;&lt;STRONG&gt;&lt;FONT size="1"&gt;&lt;EM&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;are appreciated.&amp;nbsp;T&lt;FONT color="#000000"&gt;hanks!!!!&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG style="width: 177px; height: 19px;" src="https://forums.autodesk.com/t5/image/serverpage/image-id/52487i5140CD559A7167AD/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="New EE Logo.PNG" title="New EE Logo.PNG" width="248" height="19" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/49517iE34FD88B6D1E8B3A/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Inventor.PNG" title="Inventor.PNG" width="120" height="29" align="center" /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/49518i69F7313798128E52/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="vault.PNG" title="vault.PNG" width="129" height="28" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:42:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/5482595#M53770</guid>
      <dc:creator>Cadmanto</dc:creator>
      <dc:date>2015-01-26T15:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/5482792#M53776</link>
      <description>&lt;P&gt;hi &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ithink your looking for that&lt;/P&gt;&lt;PRE&gt;oCompDef = ThisDoc.Document.ComponentDefinition
oAssyOccurrences  = oCompDef.Occurrences
Dim oOccurrence As ComponentOccurrence
Dim oSubOccurrence1 As ComponentOccurrence
For Each oOccurrence In oAssyOccurrences
If oOccurrence.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
iLogicVb.RunRule(oOccurrence.Name,"YOURRULENAME")
For Each oSubOccurrence1 In oOccurrence.SubOccurrences
If oSubOccurrence1.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
iLogicVb.RunRule(oSubOccurrence1.Name,"YOURRULENAME")
Next
End If
Next
End If
iLogicVb.UpdateWhenDone = True&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2015 17:27:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/5482792#M53776</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-26T17:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7507717#M76289</link>
      <description>&lt;P&gt;First code seems to work but it cannot find the rule I'm calling for ("YOURRULENAME"):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RunRule("Part1:1", "Test.iLogicVb"): Cannot find a rule with the name: "Test.iLogicVb".&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 12:24:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7507717#M76289</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T12:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508109#M76296</link>
      <description>&lt;P&gt;Because in the code you are trying to use there are 2 occurrence of the line in which you need to change the rule name, and APPARENTLY you only changed one.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 14:11:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508109#M76296</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-11-01T14:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508161#M76300</link>
      <description>&lt;P&gt;Yes thank you for realizing my silly mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do something amazingly simple. I'm just trying to flip the "Part Number" and the "Description" in the iProperties project tab for both the asssembly properties and each part properties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I have borrowed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oCompDef = ThisDoc.Document.ComponentDefinition
oAssyOccurrences  = oCompDef.Occurrences

Dim oOccurrence As ComponentOccurrence
Dim oSubOccurrence1 As ComponentOccurrence
For Each oOccurrence In oAssyOccurrences
If oOccurrence.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
iLogicVb.RunRule(oOccurrence.Name,"Test")

For Each oSubOccurrence1 In oOccurrence.SubOccurrences
If oSubOccurrence1.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
iLogicVb.RunRule(oSubOccurrence1.Name,"Test")

End If
Next
End If
Next&lt;/PRE&gt;&lt;P&gt;And here is the "Test" that I'm calling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;TempString = iProperties.Value("Project", "Part Number")
iProperties.Value("Project", "Description") = TempString
iProperties.Value("Project", "Part Number") = ""&lt;/PRE&gt;&lt;P&gt;It runs but doesn't do a thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 14:25:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508161#M76300</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T14:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508418#M76304</link>
      <description>&lt;P&gt;For 1; proper nesting makes things easier to read and understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For 2; your code only goes 2 levels deep in the assembly, and it becomes evident you are not a programmer.&lt;/P&gt;
&lt;P&gt;- To dig through all levels of assembly, you almost certainly need recursion. See the attached link that will provide you some better guidance on the topic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://modthemachine.typepad.com/my_weblog/2009/03/accessing-assembly-components.html" target="_blank"&gt;http://modthemachine.typepad.com/my_weblog/2009/03/accessing-assembly-components.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proper nesting shown below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;oCompDef = ThisDoc.Document.ComponentDefinition
oAssyOccurrences  = oCompDef.Occurrences

Dim oOccurrence As ComponentOccurrence
Dim oSubOccurrence1 As ComponentOccurrence&lt;BR /&gt;
For Each oOccurrence In oAssyOccurrences
    If oOccurrence.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then&lt;BR /&gt;
        iLogicVb.RunRule(oOccurrence.Name,"Test")

        For Each oSubOccurrence1 In oOccurrence.SubOccurrences
            If oSubOccurrence1.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
                iLogicVb.RunRule(oSubOccurrence1.Name,"Test")
            End If
        Next
    End If
Next&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 15:35:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508418#M76304</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-11-01T15:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508723#M76308</link>
      <description>&lt;P&gt;I agree with both of your statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But considering my inexperience, I'm trying to keep this simple for now - An assembly file with just one part in it. no recursion. Inefficient code for the sake of simplicity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having said that, can you comment on why this code is not doing what I want it to do? which is make the iProperties descriptions equal the part number and then delete the part numbers in both the assembly instance and the part instance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 17:04:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508723#M76308</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T17:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508825#M76310</link>
      <description>&lt;P&gt;Your rule starts by looking at the part, not the parent assembly file. Since the part type is not a kAssemblyDocumentObject, the IF is ignored and your rule has no effect at all. Try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oCompDef = ThisDoc.Document.ComponentDefinition
oAssyOccurrences  = ThisDocument.ComponentDefinition.Occurrences

iLogicVb.RunRule("Test")&lt;BR /&gt;&lt;BR /&gt;Dim oOccurrence As ComponentOccurrence&lt;BR /&gt;
For Each oOccurrence In oAssyOccurrences
    If oSubOccurrence1.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
          iLogicVb.RunRule(oSubOccurrence1.Name,"Test")
    End If
Next&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 17:37:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7508825#M76310</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2017-11-01T17:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509063#M76312</link>
      <description>&lt;P&gt;&lt;A href="http://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html" target="_blank"&gt;http://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main() 

    Dim oAsmDoc As AssemblyDocument 
    oAsmDoc = ThisDoc.Document&lt;BR /&gt; 
    Dim oRefDoc As Document 
    For Each oRefDoc In oAsmDoc.AllReferencedDocuments &lt;BR /&gt;&lt;BR /&gt;        oDTP = oRefDoc.PropertySet("Design Tracking Properties")&lt;BR /&gt;&lt;BR /&gt;        TempString =oDTP("Part Number").Value &lt;BR /&gt;        oDTP("Part Number").Value = oDTP("Description").Value &lt;BR /&gt;        oDTP("Description").Value = oTempString&lt;BR /&gt;    Next &lt;BR /&gt;End Sub&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 18:44:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509063#M76312</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-11-01T18:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509087#M76313</link>
      <description>&lt;P&gt;Doesn't compile.. see pic&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/420502iD4E6C094F4CFC26C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error.png" alt="Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 18:51:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509087#M76313</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T18:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509094#M76314</link>
      <description>&lt;P&gt;This doesn't run..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error2.png" style="width: 614px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/420503i991E3853A73D31E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error2.png" alt="Error2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 18:53:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509094#M76314</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T18:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509122#M76315</link>
      <description>&lt;P&gt;Sorry, I typoed. Try this one instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oCompDef = ThisDoc.Document.ComponentDefinition
oAssyOccurrences  = ThisDoc.Document.ComponentDefinition.Occurrences

iLogicVb.RunRule("Test")&lt;BR /&gt;&lt;BR /&gt;Dim oOccurrence As ComponentOccurrence&lt;BR /&gt;
For Each oOccurrence In oAssyOccurrences
    If oSubOccurrence1.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
          iLogicVb.RunRule(oSubOccurrence1.Name,"Test")
    End If
Next&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:00:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509122#M76315</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2017-11-01T19:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509201#M76316</link>
      <description>So debug it...&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:24:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509201#M76316</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-11-01T19:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509203#M76317</link>
      <description>&lt;P&gt;Not really sure what directory it's looking at but it can't find it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;RunRule: Cannot find a rule with the name: "Test.iLogicVB".&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:25:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509203#M76317</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T19:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509227#M76318</link>
      <description>&lt;P&gt;I can run "Rule0" by calling iLogicVb.RunRule("Rule0") from Rule1 (see below). If your "Test" rule is called "Test" and is in the parent file, it should work, but it's hard to tell without being able to look at the file. Any chance you can upload a copy?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/420524iF7D53BA6D6533364/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:34:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509227#M76318</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2017-11-01T19:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509268#M76319</link>
      <description>&lt;P&gt;well we are getting somewhere...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my first issue is that I was trying all these from external rules. Which is what I want in the end rather than having to browse for this rule every time i make a part. I am also not allowed to change our part templates here.. forbidden.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My other issue is that I get a new cryptic error that I don't know where to begin with..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;Error in rule: Rule1, in document: test.iam&lt;BR /&gt;&lt;BR /&gt;Object reference not set to an instance of an object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More Info:&lt;/P&gt;&lt;P&gt;System.NullReferenceException: Object reference not set to an instance of an object.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; at LmiRuleScript.Main()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:50:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509268#M76319</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-01T19:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509390#M76320</link>
      <description>&lt;P&gt;I'll do what I can, but all this is much, much easier if you provide a copy of your assembly file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open your assembly fresh, delete the previous troublesome rules, and go to your iLogic browser. click the far-right tab "External Rules", and right-click "Manually Added", then select "Create New External Rule". Navigate to the directory where you want the external rule saved. Name the first rule "DescriptionEditor". Paste in the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SyntaxEditor Code Snippet&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;TempString&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;iProperties&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Value&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Project&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Part Number&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;iProperties&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Value&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Project&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Description&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;TempString&lt;/SPAN&gt;
&lt;SPAN&gt;iProperties&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Value&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Project&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Part Number&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;""&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Now create another external rule, save it in the same directory, and call it "ChangeDescription". Paste in the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SyntaxEditor Code Snippet&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Document&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oAssyOccurrences&lt;/SPAN&gt;  &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Document&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;

&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;RunRule&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Test&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAssyOccurrences&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oSubOccurrence1&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;DefinitionDocumentType&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
          &lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;RunExternalRule&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"ChangeDescription&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Now go to your "Manage" tab at the top, and look in the iLogic section of the ribbon. Click "Event Triggers". Make sure the top-left box (Run these rules when events occur) is checked. Highlight "Before Save Document" and click the "Select Rules..." button at the bottom. Check the box beside the line that ends in "ChangeDescription" and click OK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now that all of that is done, when you save your file, the iProperty "Description" should be the previous part number, and "Part Number" should be blank.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 20:32:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509390#M76320</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2017-11-01T20:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509706#M76323</link>
      <description>&lt;P&gt;Staying consistent with your programming environment definitely helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try running what I posted from a RULE, not Vba macros. It's coded in vb.net, which is evident from the lack of SET statements when assigning objects to variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Doesn't compile.. see pic&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/420502iD4E6C094F4CFC26C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error.png" alt="Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 22:34:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7509706#M76323</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-11-01T22:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Run ilogic rule to all part in the assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7512110#M76356</link>
      <description>&lt;P&gt;I really appreciate helping out. However, it's still not working. I attached the assembly and files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing it exactly how you shown I get:&lt;/P&gt;&lt;P&gt;Error on Line 11 : 'oSubOccurrence1' is not declared. It may be inaccessible due to its protection level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if i try to declare it with the following code:&lt;/P&gt;&lt;PRE&gt;oCompDef = ThisDoc.Document.ComponentDefinition
oAssyOccurrences  = ThisDoc.Document.ComponentDefinition.Occurrences

iLogicVb.RunRule("DescriptionEditor")

Dim oSubOccurrence1 As ComponentOccurrence
Dim oOccurrence As ComponentOccurrence

For Each oOccurrence In oAssyOccurrences
    If oSubOccurrence1.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
          iLogicVb.RunExternalRule("DescriptionEditor")
    End If
Next&lt;/PRE&gt;&lt;P&gt;i still get:&lt;/P&gt;&lt;P&gt;RunRule: Cannot find a rule with the name: "DescriptionEditor".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did everything you said:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 410px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/421006i82F82967A44D3BFD/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/421008i65F1918AFF43C7A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 15:57:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/run-ilogic-rule-to-all-part-in-the-assembly/m-p/7512110#M76356</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-02T15:57:04Z</dc:date>
    </item>
  </channel>
</rss>

