<?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: iLogic Create Model State in Part won't run again in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11256622#M139684</link>
    <description>&lt;P&gt;I tested your rule in Inventor 2022&lt;STRONG&gt;.3&lt;/STRONG&gt; and it works as expected.&lt;BR /&gt;Which version are you using?&lt;/P&gt;&lt;P&gt;Is this the behaviour in any new part document?&amp;nbsp;&lt;BR /&gt;If you run the rule manually instead through button do you have the issue?&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 14:07:29 GMT</pubDate>
    <dc:creator>CattabianiI</dc:creator>
    <dc:date>2022-06-24T14:07:29Z</dc:date>
    <item>
      <title>iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11248062#M139522</link>
      <description>&lt;P&gt;Hi I have the following rule:&lt;/P&gt;&lt;PRE&gt;	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"START"&lt;/SPAN&gt;)
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
	&lt;SPAN&gt;oPCD&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
	&lt;SPAN&gt;oMStates&lt;/SPAN&gt; = &lt;SPAN&gt;oPCD&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;masterMS&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ModelState&lt;/SPAN&gt; = &lt;SPAN&gt;oMStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Master"&lt;/SPAN&gt;)
	&lt;SPAN&gt;masterMS&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
	&lt;SPAN&gt;oMState&lt;/SPAN&gt; = &lt;SPAN&gt;oMStates&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;PartNumber&lt;/SPAN&gt;)
	&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveModelState&lt;/SPAN&gt; = &lt;SPAN&gt;"Master"&lt;/SPAN&gt;
	
	&lt;SPAN&gt;PartNumber&lt;/SPAN&gt; = &lt;SPAN&gt;PartNumber&lt;/SPAN&gt;
	
	&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;UpdateWhenDone&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I call this via a button in a form. On first run it works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When trying to run again, ModelStateName being set to a different name, it will not execute.&lt;/P&gt;&lt;P&gt;The 'START' message box doesn't even appear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something wrong with my code or is this a bug??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be great &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;</description>
      <pubDate>Tue, 21 Jun 2022 09:11:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11248062#M139522</guid>
      <dc:creator>zoe.baker-bushby</dc:creator>
      <dc:date>2022-06-21T09:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11249115#M139540</link>
      <description>&lt;P&gt;Hi, this line is the problem for me :&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveModelState&lt;/SPAN&gt; = &lt;SPAN&gt;"Master"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;It may be unnecessary since the state of the activated model does not change with the execution of the code.&lt;/P&gt;&lt;P&gt;You can test by commenting it.&lt;/P&gt;&lt;P&gt;Hope this will help you. Vincent.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:53:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11249115#M139540</guid>
      <dc:creator>vpeuvion</dc:creator>
      <dc:date>2022-06-21T15:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11250686#M139567</link>
      <description>&lt;P&gt;The activated model state does change though?&lt;/P&gt;&lt;P&gt;When you create a new model state it automatically changes to the new state?&lt;/P&gt;&lt;P&gt;Just running something as small as:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"START"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;oPCD&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oMStates&lt;/SPAN&gt; = &lt;SPAN&gt;oPCD&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;
&lt;SPAN&gt;oMState&lt;/SPAN&gt; = &lt;SPAN&gt;oMStates&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;PartNumber&lt;/SPAN&gt;)
&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;UpdateWhenDone&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Changes the state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are however correct in saying that:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveModelState&lt;/SPAN&gt; = &lt;SPAN&gt;"Master"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Is the line that is making it so that the rule does not run again.&lt;/P&gt;&lt;P&gt;However, I need it to toggle back to Master.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Changing syntax to:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;masterMS&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ModelState&lt;/SPAN&gt; = &lt;SPAN&gt;oMStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Master"&lt;/SPAN&gt;)
&lt;SPAN&gt;masterMS&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;Also doesn't work. It again runs once but won't run again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I make a separate rule which just has:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ThisDoc.ActiveModelState = "Master"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can then call this from my other rule and everything works fine...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"START"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;oPCD&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oMStates&lt;/SPAN&gt; = &lt;SPAN&gt;oPCD&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;
&lt;SPAN&gt;oMState&lt;/SPAN&gt; = &lt;SPAN&gt;oMStates&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;PartNumber&lt;/SPAN&gt;)
&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN&gt;"Master"&lt;/SPAN&gt;)
&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;UpdateWhenDone&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;So the order I am trying to do things is fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This has got to be a bug?&lt;/P&gt;&lt;P&gt;Unless I am just overlooking something&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@795596742BBE9063EFA1B55C0747436D/emoticons/1f615.png" alt=":confused_face:" title=":confused_face:" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 08:35:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11250686#M139567</guid>
      <dc:creator>zoe.baker-bushby</dc:creator>
      <dc:date>2022-06-22T08:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11253619#M139619</link>
      <description>&lt;P&gt;Hello, Yes you are right, it is changing to the new state. I did some tests on ilogic and I need to open the rule to be able to run the code again.&lt;BR /&gt;I've never encountered this scenario and I don't know what's going on.&lt;BR /&gt;I hope that using a second rule has allowed you to unblock the situation.&lt;BR /&gt;I can't help you more, maybe someone has already encountered this problem and can help you? Either way, I'd be curious to know what's wrong.&lt;/P&gt;&lt;P&gt;Vincent.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 11:03:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11253619#M139619</guid>
      <dc:creator>vpeuvion</dc:creator>
      <dc:date>2022-06-23T11:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11256622#M139684</link>
      <description>&lt;P&gt;I tested your rule in Inventor 2022&lt;STRONG&gt;.3&lt;/STRONG&gt; and it works as expected.&lt;BR /&gt;Which version are you using?&lt;/P&gt;&lt;P&gt;Is this the behaviour in any new part document?&amp;nbsp;&lt;BR /&gt;If you run the rule manually instead through button do you have the issue?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 14:07:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11256622#M139684</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2022-06-24T14:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11260265#M139718</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using 2022.3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried running it in a new part, see screen recording:&lt;/P&gt;&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/community/screencast/724636bd-4ca1-437c-872b-bbb5c843bd6f" target="_blank"&gt;Rule doesn't run twice | Search | Autodesk Knowledge Network&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is running the original code I posted.&lt;/P&gt;&lt;P&gt;As you can see it runs once, but to be able to run again you have to open and then close the rule??&lt;/P&gt;&lt;P&gt;Once opened and closed, you can choose to right click and run or click the button in the form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Zoe&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 07:29:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11260265#M139718</guid>
      <dc:creator>zoe.baker-bushby</dc:creator>
      <dc:date>2022-06-27T07:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Create Model State in Part won't run again</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11261381#M139744</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9288771"&gt;@zoe.baker-bushby&lt;/a&gt;,&lt;BR /&gt;you're right and I've the exact behaviour now.&lt;BR /&gt;&lt;BR /&gt;I simplified the rule, and just switching between model states causes the issue.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Create another model state named "Model State1" , add and run the rule, first time it runs then nothing.&lt;/P&gt;&lt;PRE&gt;	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"START"&lt;/SPAN&gt;)
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;modelStates&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ModelStates&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;masterMs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ModelState&lt;/SPAN&gt; = &lt;SPAN&gt;modelStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Master"&lt;/SPAN&gt;)
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ms1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ModelState&lt;/SPAN&gt; = &lt;SPAN&gt;modelStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Model State1"&lt;/SPAN&gt;)
	&lt;SPAN&gt;ms1&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
	&lt;SPAN&gt;masterMs&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;()	&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/486618"&gt;@johnsonshiue&lt;/a&gt;&amp;nbsp;could you look into this?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 15:44:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-create-model-state-in-part-won-t-run-again/m-p/11261381#M139744</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2022-06-27T15:44:18Z</dc:date>
    </item>
  </channel>
</rss>

