<?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 control parameters in Model States. in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/12765297#M51212</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3474788"&gt;@CattabianiI&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I trying to use your code in inventor 2024 and it fails when trying to update the parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd appreciate any input you could provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'Set Grille style using Model States&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;LinearBarLength&lt;/SPAN&gt; = &lt;SPAN&gt;GrillLength&lt;/SPAN&gt; - &lt;SPAN&gt;GrillToFeameClearance&lt;/SPAN&gt;
&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveModelState&lt;/SPAN&gt;(&lt;SPAN&gt;"Linear Bar"&lt;/SPAN&gt;)=&lt;SPAN&gt;BarGrilleStyle&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;asmDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&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;occSide&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;ItemByName&lt;/SPAN&gt;(&lt;SPAN&gt;"Linear Bar"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;facDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;occSide&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;FactoryDocument&lt;/SPAN&gt;

&lt;SPAN&gt;' Make sure the factory has activated the model state I want to work with&lt;/SPAN&gt;
&lt;SPAN&gt;' I do not change the active model state for the occurrence&lt;/SPAN&gt;
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;BarGrilleStyle&lt;/SPAN&gt;).&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;ModelParameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"length"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt; = &lt;SPAN&gt;LinearBarLength&lt;/SPAN&gt;
&lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Here is the error&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="J_Dumont_0-1715356693401.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1360612i86A190D75BF731D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="J_Dumont_0-1715356693401.png" alt="J_Dumont_0-1715356693401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2024 15:58:52 GMT</pubDate>
    <dc:creator>J_Dumont</dc:creator>
    <dc:date>2024-05-10T15:58:52Z</dc:date>
    <item>
      <title>iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10221868#M51199</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question has to do with the addition of Model States in Inventor. I want to control parameters from iLogic according to Model State from an assembly. Sure I can set manually or from excel, different values for parameters in the part, but in the assembly some of those, in my case, are often changing according to the use of the part and the customer's order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until 2021 I was connecting the parameters of an assembly via ilogic, with parameters inside the parts that belong to this assembly. So by changing the parameter in the assembly, all the parts with an ilogic connection to it, were changing accordingly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With model states, how can I specify which exact parameter i want to change to the exact model state?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify I will give an example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;- I have Part1 that has a parameter called "Length". This parameter changes according to 3 model states.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Model State1 =&amp;gt;&amp;nbsp; &amp;nbsp;Length = 1000 mm&lt;/P&gt;&lt;P&gt;Model State2 =&amp;gt;&amp;nbsp; &amp;nbsp;Length = 2000 mm&lt;/P&gt;&lt;P&gt;Model State3 =&amp;gt;&amp;nbsp; &amp;nbsp;Length = 3000 mm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- In an assembly I have 3 parameters called "Length_1",&amp;nbsp; "Length_2", and&amp;nbsp;"Length_3".&lt;/P&gt;&lt;P&gt;Now in the assemply I will add Part1 with 3 model states, and I would like to connect it with the bellow logic:&lt;/P&gt;&lt;P&gt;Parameter("Part1:1" , "Length")&amp;nbsp; = Length_1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; '(Model State1)&lt;/P&gt;&lt;P&gt;Parameter("Part1:2" , "Length")&amp;nbsp; = Length_2&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; '(Model State2)&lt;/P&gt;&lt;P&gt;Parameter("Part1:3" , "Length")&amp;nbsp; = Length_3&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'(Model State3)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a colleague we managed to find a&amp;nbsp;solution that seems to be working:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim AssDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim Occ As Inventor.ComponentOccurrence
Dim partcomp As PartComponentDefinition
Dim partdoc As Inventor.PartDocument

Occ = AssDoc.ComponentDefinition.Occurrences.ItemByName("Part1:1")
partdoc = Occ.Definition.Document
Occ.ActiveModelState = "Model State1"
partdoc.ComponentDefinition.Parameters.UserParameters.Item("Length").Value = Length_1

AssDoc.Update2
AssDoc.Save2


Occ = AssDoc.ComponentDefinition.Occurrences.ItemByName("Part1:2")
partdoc = Occ.Definition.Document
Occ.ActiveModelState = "Model State2"
partdoc.ComponentDefinition.Parameters.UserParameters.Item("Length").Value = Length_2

AssDoc.Update2
AssDoc.Save2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simpler way or better way to do that?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 13:33:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10221868#M51199</guid>
      <dc:creator>theo_karypidis</dc:creator>
      <dc:date>2021-04-08T13:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10222541#M51200</link>
      <description>&lt;P&gt;First of all you should be clear if you need to take advantage the new model state concept, for example if you want iProperties changing with model state. If you think this way fits your needs better by improving previous Inventor workflow, that's how I would implement it in Inv2022.&lt;BR /&gt;In this case DO NOT WORK with parameters AND model states, the parameter change is already define in the model state.&lt;BR /&gt;&lt;BR /&gt;Place the occurrences in assembly, without worrying about the active model state, I would place them in the master one. Then add the rule and change the asm parameters as you want.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim length2ModelState As New Dictionary(Of Integer, String) From {
{1000, "Model State1" },
{2000, "Model State2" },
{3000, "Model State3" }
' Or changing the model states name with explanatory name
'{1000, "short" },
'{2000, "medium" },
'{3000, "long" }
}

Dim AssDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim Occ As Inventor.ComponentOccurrence
Dim partcomp As PartComponentDefinition
Dim partdoc As Inventor.PartDocument


Occ = AssDoc.ComponentDefinition.Occurrences.ItemByName("Part1:1")
Occ.ActiveModelState = length2ModelState(Length_1)

Occ = AssDoc.ComponentDefinition.Occurrences.ItemByName("Part1:2")
Occ.ActiveModelState = length2ModelState(Length_2)

AssDoc.Update2
AssDoc.Save2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 16:42:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10222541#M51200</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2021-04-08T16:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10224528#M51201</link>
      <description>&lt;P&gt;Good morning, and thank you for the reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For sure, I want to take advantage of the model state concept. So, in the code you gave me you assume that the part has the same Parameter called Length_1 like in the Assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is not true though. In my case The assembly has 3 parameters&amp;nbsp;Length_1,&amp;nbsp;Length_2 and Length_3 that will change one parameter in the part called Length. Depending on each model state of course.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, the parameters&amp;nbsp;Length_1,&amp;nbsp;Length_2 and Length_3 that drive the part are changing according to the customers order.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 10:32:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10224528#M51201</guid>
      <dc:creator>theo_karypidis</dc:creator>
      <dc:date>2021-04-09T10:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10225365#M51202</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Let's just discuss about that three measures at the moment.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; in the code you gave me you assume that the part has the same Parameter called Length_1 like in the Assembly.&lt;BR /&gt;No! I don't work with part parameter, I just use the assembly parameter to activate the linked model state.&lt;BR /&gt;It's the model state which drives the part length.&lt;BR /&gt;And this is how your model state table should look like:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CattabianiI_0-1617982052775.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/904420i26F37C5343FC7117/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CattabianiI_0-1617982052775.png" alt="CattabianiI_0-1617982052775.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hence from the assembly you don't have to set the part length anymore but just activate the proper model state.&lt;BR /&gt;Am I missing something? Did you get the workflow I'm pointing out here?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:30:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10225365#M51202</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2021-04-09T15:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10226169#M51203</link>
      <description>&lt;P&gt;Yes of course I get what you are saying. I am well aware of the "proper" use of model states. In many cases I will use it just the way you are saying.&amp;nbsp;In the case I am describing though, things are a bit different. I will give you a simplified yet real example that may be more clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have an elevator platform that on each side except the front side (entrance), it has a sheet metal apron. This apron is the same as a design concept, no matter the side, in all except its length.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the elevator, varies in sizes in depth and width according to the customer order. So the aprons too can take hundreds of different lengths.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Until now I was instructing the designers to have separate apron files for the sides (left, right) and rear to be able to coexist in an assembly.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;With the addition of the model states, we have the ability to create with one part file, different configurations with different properties. This will simplify our work a lot in some cases, in design as well as in the software developing for modeling.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;So, in trying to find ways to do the above, I created as a test an apron that has 2 model states one for the side apron (left &amp;amp; right) and one for the rear apron.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-family: inherit;"&gt;Apron.ipt&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-family: inherit;"&gt;- Side (model state)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-family: inherit;"&gt;- Rear&amp;nbsp;(model state)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;In the assembly, I have the same apron part added with the 2 different model states. There are 2 dimensions for the platform that control depth and width of the elevator cabin and therefore the platform and the aprons.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Platform.iam&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;--&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;Apron.ipt with&amp;nbsp;Side (model state)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;-- &lt;SPAN style="font-family: inherit;"&gt;Apron.ipt with Rear&amp;nbsp;(model state)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;That means that with each customer order, the generated assembly is giving to each connected part via ilogic a new value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-family: inherit;"&gt;Platform width = Rear Apron Length&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-family: inherit;"&gt;Platform depth = side Apron Length&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the &lt;SPAN style="font-family: inherit;"&gt;Platform&lt;/SPAN&gt;&amp;nbsp;width is 1100 then the apron with rear model state has also length 1100 and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the &lt;SPAN style="font-family: inherit;"&gt;Platform &lt;/SPAN&gt;depth is 1400 then the apron with side model state has also length 1400 and so on.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 20:30:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10226169#M51203</guid>
      <dc:creator>theo_karypidis</dc:creator>
      <dc:date>2021-04-09T20:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10227334#M51204</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2839823"&gt;@theo_karypidis&lt;/a&gt;,&lt;BR /&gt;yes it's more clear now, thanks.&lt;BR /&gt;&lt;BR /&gt;I attached an example of your use case. The main difference with the rule you posted above is that I set the parameter in the factory document. It's not 100% clear to me but what I understand from my testing is that when I had to _write_ data into a model state is better to do this through the factory document.&lt;BR /&gt;So this is the rule I came up with:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;asmDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&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;occSide&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;ItemByName&lt;/SPAN&gt;(&lt;SPAN&gt;"Side"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;facDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;occSide&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;FactoryDocument&lt;/SPAN&gt;
&lt;BR /&gt;' Make sure the factory has activated the model state I want to work with&lt;BR /&gt;' I do not change the active model state for the occurrence
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Side"&lt;/SPAN&gt;).&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;ModelParameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"length"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt; = &lt;SPAN&gt;Width&lt;/SPAN&gt;
&lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()

&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Rear"&lt;/SPAN&gt;).&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;ModelParameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"length"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt; = &lt;SPAN&gt;Length&lt;/SPAN&gt;
&lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()

&lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;I create a form to configure the platform.&lt;BR /&gt;The model state table of Apron.ipt must have the length param column.&lt;BR /&gt;The occurrences are already placed in the platform in the proper model state, if that fits your needs otherwise you can active the occurrence model state with the ComponentOccurrence.ActiveModelState property but you still have to set the parameter through the factory document as in the code above.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Apr 2021 12:46:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10227334#M51204</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2021-04-10T12:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10230324#M51205</link>
      <description>&lt;P&gt;This works perfectly! It's a different approach to my solution, and it will help me a lot in the more complicated automation!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 06:07:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10230324#M51205</guid>
      <dc:creator>theo_karypidis</dc:creator>
      <dc:date>2021-04-12T06:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10643196#M51206</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Whenever I use this code to update my parameters it converts my inch parameters to metric. Is there a way to utilize this code within the imperial system?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 17:40:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10643196#M51206</guid>
      <dc:creator>ndillner343SKL</dc:creator>
      <dc:date>2021-09-23T17:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10644754#M51207</link>
      <description>&lt;P&gt;Check out this article and in case open another post on the forum:&amp;nbsp;&lt;A href="https://adndevblog.typepad.com/manufacturing/2012/07/unitsofmeasure-object-and-example.html" target="_blank"&gt;https://adndevblog.typepad.com/manufacturing/2012/07/unitsofmeasure-object-and-example.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 10:24:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10644754#M51207</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2021-09-24T10:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10774007#M51208</link>
      <description>&lt;P&gt;Understand this is an old post...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to get some parameters to past to model states using this syntax:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;ModelParameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item("Param1").Value = Param2&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;It does pass BUT the Param1 becomes 10 x Param2.&lt;/P&gt;&lt;P&gt;Believe this is a unit thing but both documents are in millimeters. Both parameters are in millimeters.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tested printing:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MessageBox.Show(facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;ModelParameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item("Param1").Units)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This returns mm&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help on this would be amazing.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 16:02:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10774007#M51208</guid>
      <dc:creator>zoe.baker-bushby</dc:creator>
      <dc:date>2021-11-22T16:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10774160#M51209</link>
      <description>&lt;P&gt;It is the link in the message just above yours, where you can find out how to convert the database units (the ones Inventor uses internally) into the units you need and vice versa&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 16:56:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10774160#M51209</guid>
      <dc:creator>CattabianiI</dc:creator>
      <dc:date>2021-11-22T16:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10775665#M51210</link>
      <description>&lt;P&gt;As an update to the subject, you can take a look at my post on the link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/managing-changes-in-model-states-ilogic/td-p/10775657" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/managing-changes-in-model-states-ilogic/td-p/10775657&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 08:02:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10775665#M51210</guid>
      <dc:creator>theo_karypidis</dc:creator>
      <dc:date>2021-11-23T08:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10894690#M51211</link>
      <description>&lt;P&gt;Hi, I would like use Model States feature use for simplify assemblies only with suppressed OC parts:&lt;BR /&gt;Master - all parts active&lt;BR /&gt;Simple - all subassy in MS Simply + OC in top level suppress&lt;BR /&gt;Simple DRW - all subassy in MS Simply + OC in top level active&lt;BR /&gt;But if not apply change use for all family, in exist model states not update mates parameters and after activate other state is components in other positions.&lt;BR /&gt;Can you help me with rule for delete all columns in modelstates.table for clear table (except first culomn with model states name).&lt;BR /&gt;I wrote rule for suppress OC part in all standard model state, so after clear table is fill only suppressed parts and no parameters changes.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 21:15:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/10894690#M51211</guid>
      <dc:creator>josef_kostecký</dc:creator>
      <dc:date>2022-01-20T21:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic control parameters in Model States.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/12765297#M51212</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3474788"&gt;@CattabianiI&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I trying to use your code in inventor 2024 and it fails when trying to update the parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd appreciate any input you could provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'Set Grille style using Model States&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;LinearBarLength&lt;/SPAN&gt; = &lt;SPAN&gt;GrillLength&lt;/SPAN&gt; - &lt;SPAN&gt;GrillToFeameClearance&lt;/SPAN&gt;
&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveModelState&lt;/SPAN&gt;(&lt;SPAN&gt;"Linear Bar"&lt;/SPAN&gt;)=&lt;SPAN&gt;BarGrilleStyle&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;asmDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&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;occSide&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;ItemByName&lt;/SPAN&gt;(&lt;SPAN&gt;"Linear Bar"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;facDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;occSide&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;FactoryDocument&lt;/SPAN&gt;

&lt;SPAN&gt;' Make sure the factory has activated the model state I want to work with&lt;/SPAN&gt;
&lt;SPAN&gt;' I do not change the active model state for the occurrence&lt;/SPAN&gt;
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;ModelStates&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;BarGrilleStyle&lt;/SPAN&gt;).&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
&lt;SPAN&gt;facDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;ModelParameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"length"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt; = &lt;SPAN&gt;LinearBarLength&lt;/SPAN&gt;
&lt;SPAN&gt;asmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Here is the error&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="J_Dumont_0-1715356693401.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1360612i86A190D75BF731D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="J_Dumont_0-1715356693401.png" alt="J_Dumont_0-1715356693401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 15:58:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-control-parameters-in-model-states/m-p/12765297#M51212</guid>
      <dc:creator>J_Dumont</dc:creator>
      <dc:date>2024-05-10T15:58:52Z</dc:date>
    </item>
  </channel>
</rss>

