<?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: Immediately update Reference Parameter to use in iLogic code in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482491#M63884</link>
    <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;I downloaded your part and did some testing.&lt;/P&gt;&lt;P&gt;This ilogic rule works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #0000ff;"&gt;Length1&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;DesiredLength&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;RuleParametersOutput&lt;/SPAN&gt;()
&lt;SPAN style="color: #800080;"&gt;InventorVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;DocumentUpdate&lt;/SPAN&gt;()
&lt;SPAN style="color: #800080;"&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Length2"&lt;/SPAN&gt;) = &lt;SPAN style="color: #800000;"&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"RemainingLength"&lt;/SPAN&gt;) &lt;SPAN style="color: #808080;"&gt;'Access parameters like this to not trigger the rule again.&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 12:26:48 GMT</pubDate>
    <dc:creator>JhoelForshav</dc:creator>
    <dc:date>2020-04-30T12:26:48Z</dc:date>
    <item>
      <title>Immediately update Reference Parameter to use in iLogic code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482314#M63881</link>
      <description>&lt;P&gt;I have iLogic code that alters my sketch, which changes the value of a Reference Parameter. I want to use that Reference Parameter to alter another sketch through iLogic.&lt;/P&gt;&lt;P&gt;The problem is, the&amp;nbsp;Reference Parameter is not updated immediately, so the iLogic code needs to be run twice to get the right value of the Reference Parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To illustrate the issue, I created a sketch as shown:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CaptureReferenceParameter.PNG" style="width: 559px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/763050iC106DB8B3F7A2430/image-size/large?v=v2&amp;amp;px=999" role="button" title="CaptureReferenceParameter.PNG" alt="CaptureReferenceParameter.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I run the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Length1 = DesiredLength
Length2 = RemainingLength
iLogicVb.UpdateWhenDone = True&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So Length1 is immediately set to the value of DesiredLength when the code is run, but RemainingLength is not updated, so Length 2 is not updated. If I run the code again, first then Length2 is updated correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that in this specific case I could constrain the two squares to each other, or use following code instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Length2 = MaxLength - Length1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But my real user case is much more complex, involving multiple parameters and trigonometry, so I would prefer to use Reference Parameter as input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this even be done, or is it a limitation in the way iLogic code is executed?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 11:16:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482314#M63881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-30T11:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Immediately update Reference Parameter to use in iLogic code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482465#M63882</link>
      <description>&lt;P&gt;Have you tried placing the update code between the two lines?&lt;/P&gt;&lt;P&gt;You can also try this option at the top of the rule:&lt;/P&gt;&lt;P&gt;Parameter.UpdateAfterChange = True&lt;/P&gt;&lt;P&gt;Its description is as follows:&lt;/P&gt;&lt;P&gt;If this is true, a document update will be performed automatically after a parameter value is changed with a Parameter function (Parameter.Value) in the current rule.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 12:17:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482465#M63882</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-04-30T12:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Immediately update Reference Parameter to use in iLogic code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482473#M63883</link>
      <description>&lt;P&gt;Here is another update line you might try:&lt;/P&gt;&lt;P&gt;RuleParametersOutput()&lt;/P&gt;&lt;P&gt;Its description is as follows:&lt;/P&gt;&lt;P&gt;Apply the modified values of any Inventor parameters used as local variables in this rule to the Inventor model.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 12:20:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482473#M63883</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-04-30T12:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Immediately update Reference Parameter to use in iLogic code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482491#M63884</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;I downloaded your part and did some testing.&lt;/P&gt;&lt;P&gt;This ilogic rule works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #0000ff;"&gt;Length1&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;DesiredLength&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;RuleParametersOutput&lt;/SPAN&gt;()
&lt;SPAN style="color: #800080;"&gt;InventorVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;DocumentUpdate&lt;/SPAN&gt;()
&lt;SPAN style="color: #800080;"&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Length2"&lt;/SPAN&gt;) = &lt;SPAN style="color: #800000;"&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"RemainingLength"&lt;/SPAN&gt;) &lt;SPAN style="color: #808080;"&gt;'Access parameters like this to not trigger the rule again.&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 12:26:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482491#M63884</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-04-30T12:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Immediately update Reference Parameter to use in iLogic code</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482597#M63885</link>
      <description>&lt;P&gt;Thanks all!&lt;BR /&gt;This has been giving me a headache for some time, and I tried living with it. Glad to have it solved! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 13:09:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/immediately-update-reference-parameter-to-use-in-ilogic-code/m-p/9482597#M63885</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-30T13:09:01Z</dc:date>
    </item>
  </channel>
</rss>

