<?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: Force external iLogic rule to run in component it was triggered from in Inventor Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733556#M368351</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/74757"&gt;@mcgyvr&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Sounds like an issue with your specific code..&lt;/P&gt;&lt;P&gt;I have numerous parts with an external rule that runs from an event (save) triggers. These rules do NOT effect the iam they are placed in at all..&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Got it! All I had to do was replace "ThisApplication.ActiveDocument" with "ThisDoc.Document", and now the code is executed on the document it's triggered from (the part), rather than the active document (the assembly). Thanks for getting me on the right track,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/74757"&gt;@mcgyvr&lt;/a&gt;!&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2015 13:42:09 GMT</pubDate>
    <dc:creator>DRoam</dc:creator>
    <dc:date>2015-07-22T13:42:09Z</dc:date>
    <item>
      <title>Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5718793#M368345</link>
      <description>&lt;P&gt;I have a part which is set to run a specific external iLogic rule before the part is saved.&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;The external rule creates a parameter in the part if the parameter doesn't already exist, among other things.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm having is, if I do a save on an assembly that contains the part, then when I save, Inventor runs the external rule per the save trigger but it executes the code on the active assembly, not on the part that contained the "run this rule when I save" trigger. As a result it creates the parameter in the assembly rather than the part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to force Inventor to execute the rule's code on the part it was triggered by, rather than the active document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's my understanding that local rules work this way. If I have a trigger in the part to run a rule&amp;nbsp;&lt;EM&gt;stored within the part&lt;/EM&gt; upon save, then even if I save the part from the assembly level, Inventor will recognize the rule resides within the part and execute the code on the part. But in this case, &lt;SPAN&gt;because there are specific reasons for the rule being external rather than local,&amp;nbsp;&lt;/SPAN&gt;I need to find a way for triggered external rules to function the same way. How can I do this?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2015 16:12:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5718793#M368345</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2015-07-14T16:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5718852#M368346</link>
      <description>&lt;P&gt;Two things you could try running at the assembly level:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;iLogicVb.RunExternalRule(oComponentOccurrence, "external rule name")&lt;/PRE&gt;&lt;P&gt;I can't remember if that syntax works or not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or,&lt;/P&gt;&lt;PRE&gt;oComponentOccurrence.Edit()

iLogicVb.RunExternalRule("external rule name")

oComponentOccurrence.ExitEdit(63746) 'exit to Parent&lt;/PRE&gt;&lt;P&gt;Brandon&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2015 16:46:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5718852#M368346</guid>
      <dc:creator>BrandonBG</dc:creator>
      <dc:date>2015-07-14T16:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733395#M368347</link>
      <description>&lt;P&gt;Hi Brandon, thanks for the reply. The probelm with that approach is that the rule has to be triggered from the part itself, because it has to be triggered as an Event Trigger when the part is saved. This way, it always and only runs if the part has been changed, which is what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;All: Is there a way I can have an internal rule grab code from an external rule (or even some other external source, like a text file), and execute that as part of the internal rule?&lt;/STRONG&gt; (I know I can trigger an External rule from an internal rule, but I assume it would still execute as an external rule, and act on the active document, rather than the document it was triggered from. But if I could have the internal rule itself execute the code...)&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 12:20:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733395#M368347</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2015-07-22T12:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733488#M368348</link>
      <description>&lt;P&gt;Sounds like an issue with your specific code..&lt;/P&gt;
&lt;P&gt;I have numerous parts with an external rule that runs from an event (save) triggers. These rules do NOT effect the iam they are placed in at all..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 13:13:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733488#M368348</guid>
      <dc:creator>mcgyvr</dc:creator>
      <dc:date>2015-07-22T13:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733510#M368349</link>
      <description>&lt;P&gt;Oh ok, interesting. Do any of those external rules create User Parameters if they're missing?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 13:21:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733510#M368349</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2015-07-22T13:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733530#M368350</link>
      <description>&lt;P&gt;I think I might have found the issue. Here is the line of code that creates the parameter if it's missing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters.AddByExpression("Schedule", myparam, "ul")&lt;/PRE&gt;&lt;P&gt;You can see it's accessing the active document, so if I'm in my assembly and do a save, and my part gets saved, the assembly will be the active document so the parameter will be added to the assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the question is, is there a way to create a user parameter within the document that a rule is being executed on, rather than the active document? I'll do some looking but if you know the answer that would be great!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 13:27:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733530#M368350</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2015-07-22T13:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Force external iLogic rule to run in component it was triggered from</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733556#M368351</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/74757"&gt;@mcgyvr&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Sounds like an issue with your specific code..&lt;/P&gt;&lt;P&gt;I have numerous parts with an external rule that runs from an event (save) triggers. These rules do NOT effect the iam they are placed in at all..&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Got it! All I had to do was replace "ThisApplication.ActiveDocument" with "ThisDoc.Document", and now the code is executed on the document it's triggered from (the part), rather than the active document (the assembly). Thanks for getting me on the right track,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/74757"&gt;@mcgyvr&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 13:42:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/force-external-ilogic-rule-to-run-in-component-it-was-triggered/m-p/5733556#M368351</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2015-07-22T13:42:09Z</dc:date>
    </item>
  </channel>
</rss>

