<?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: How to make a dimension driven using iLogic in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11167333#M37148</link>
    <description>&lt;P&gt;i created a rule with the code that you gave me but it doesn't convert Length_A into a driven dimension. When i run it and the dimension Length_A is not driven it does nothing, but when Length_A is driven the rule conferts it into a non driven rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the file that i used, the ruler's name is Length_A&lt;/P&gt;</description>
    <pubDate>Fri, 13 May 2022 14:45:19 GMT</pubDate>
    <dc:creator>JonnyPot</dc:creator>
    <dc:date>2022-05-13T14:45:19Z</dc:date>
    <item>
      <title>How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11163680#M37142</link>
      <description>&lt;P&gt;Hello every one, I whant to make the dimension below (Lato L) driven using iLogic&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="JonnyPot_0-1652338286582.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066163i6079926DE00A034A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JonnyPot_0-1652338286582.png" alt="JonnyPot_0-1652338286582.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 06:53:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11163680#M37142</guid>
      <dc:creator>JonnyPot</dc:creator>
      <dc:date>2022-05-12T06:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11164432#M37143</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9829071"&gt;@JonnyPot&lt;/a&gt;.&amp;nbsp; Here is something you can use for that.&amp;nbsp; This example just uses the Pick method to allow you to select the dimension, but the main point of this example is showing you how the property of the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-7CDE8986-36C4-4AC6-B88B-55481AD3AD5D" target="_blank" rel="noopener"&gt;DimensionConstraint&lt;/A&gt; object called &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-11B48566-8976-4AB4-ABD9-0D814F8AC4B8" target="_blank" rel="noopener"&gt;Driven&lt;/A&gt; can be used to toggle that setting you want to control.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter, oPrompt)
If IsNothing(oObj) OrElse (TypeOf oObj Is DimensionConstraint = False) Then Exit Sub
Dim oDimC As DimensionConstraint = oObj
If Not oDimC.Driven Then oDimC.Driven = True&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 13:16:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11164432#M37143</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-12T13:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11164546#M37144</link>
      <description>&lt;P&gt;Hello, thank you for the replay. is it possible to make it so that i dont have to pick the dimension, for example a rule that when run it only transforms a dimension into a driven dimension,&amp;nbsp;i tried making it as follows but i keep getting "Type 'DimensionConstraint.Driven' is not defined."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;LatoA1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DimensionConstraint&lt;/SPAN&gt;.&lt;SPAN&gt;Driven&lt;/SPAN&gt; = &lt;SPAN&gt;LatoA&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;LatoA1&lt;/SPAN&gt;.&lt;SPAN&gt;Driven&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;LatoA1&lt;/SPAN&gt;.&lt;SPAN&gt;Driven&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 13:52:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11164546#M37144</guid>
      <dc:creator>JonnyPot</dc:creator>
      <dc:date>2022-05-12T13:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11164677#M37145</link>
      <description>&lt;P&gt;Sure.&amp;nbsp; You don't have to use the Pick method to specify which dimension to target.&amp;nbsp; There are certainly other ways, but since I'm not familiar with your existing design document, and don't even know if it is a part or an assembly, I have no way of knowing which dimension within which sketch to find using normal means.&amp;nbsp; And I don't know what 'LotaA' represents in the code you posted.&amp;nbsp; But I do know that you shouldn't have the ".Driven" part at the end of "As DrawingDimension.Driven"...it should just by "As DrawingDimension" because that is the object Type.&amp;nbsp; Driven is a Property of that DrawingDimension object that represents a Boolean value.&amp;nbsp; If the sketch is 'active' or in 'edit mode' when you run the rule, I could capture that sketch using the term 'ThisApplication.ActiveEditObject', but if that's not the case, I will just try to get the last sketch that was created within the active model document.&amp;nbsp; Then once I have a sketch to target, I will attempt to identify a single dimensional constraint within that sketch, and hope that it's the right one.&amp;nbsp; If the first dimension is not the right one, then we will have to find another way to identify the correct dimension without manually selecting it.&lt;/P&gt;
&lt;P&gt;Here is my new example code for you to try out.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oSketch As PlanarSketch = Nothing
If TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
	oSketch = ThisApplication.ActiveEditObject
Else
	Dim oSketches As PlanarSketches = ThisDoc.Document.ComponentDefinition.Sketches
	oSketch = oSketches.Item(oSketches.Count) 'the last sketch created
End If
Dim oDimConst As DimensionConstraint = oSketch.DimensionConstraints.Item(1)
If Not oDimConst.Driven Then oDimConst.Driven = True&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 12 May 2022 14:24:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11164677#M37145</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-12T14:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11166758#M37146</link>
      <description>&lt;P&gt;hi, my sketch (named Perimeter) its in a assembly, and i would like to make the dimension "Length_A" driven&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="JonnyPot_0-1652438191231.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066795iEADE659B5AF22A87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JonnyPot_0-1652438191231.png" alt="JonnyPot_0-1652438191231.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 10:38:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11166758#M37146</guid>
      <dc:creator>JonnyPot</dc:creator>
      <dc:date>2022-05-13T10:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11166854#M37147</link>
      <description>&lt;P&gt;OK.&amp;nbsp; I was able to open your model and see the sketch &amp;amp; dimensions.&amp;nbsp; Although the referenced components didn't load correctly, I was able to quickly create a simple iLogic rule that will do the task.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oADoc As AssemblyDocument = ThisDoc.Document
oSketch = oADoc.ComponentDefinition.Sketches.Item("Perimeter")
For Each oDim As DimensionConstraint In oSketch.DimensionConstraints
	If oDim.Parameter.Name = "Length_A" Then
		If Not oDim.Driven Then
			oDim.Driven = True
		End If
	End If
Next&lt;/LI-CODE&gt;
&lt;P&gt;The rule immediately changed the status of the dimension from 'driving' to 'driven', without the sketch even needing to be in 'edit mode'.&amp;nbsp; Since we know the name of the sketch, and that the sketch was created within the context of the main assembly, I just got the sketch by its name.&amp;nbsp; Then to find the right dimensional constraint within the sketch, I simply looped through all the dimensional constraints within the sketch, checking the name of the Parameter it is tied to for "Length_A".&amp;nbsp; When found, simply change its Driven property's value to True.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 11:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11166854#M37147</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-13T11:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11167333#M37148</link>
      <description>&lt;P&gt;i created a rule with the code that you gave me but it doesn't convert Length_A into a driven dimension. When i run it and the dimension Length_A is not driven it does nothing, but when Length_A is driven the rule conferts it into a non driven rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the file that i used, the ruler's name is Length_A&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 14:45:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11167333#M37148</guid>
      <dc:creator>JonnyPot</dc:creator>
      <dc:date>2022-05-13T14:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a dimension driven using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11167730#M37149</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9829071"&gt;@JonnyPot&lt;/a&gt;.&amp;nbsp; I opened new top level assembly in your latest zip file.&amp;nbsp; At first, sketch dimension using the "Length_A" parameter did not have the "(" and ")" symbols around its name.&amp;nbsp; That means it is currently 'driving' (in control of) the geometry.&amp;nbsp; When I enter into edit mode of the sketch, then right click on that dimension, I have the option in my radial menu to turn it into a 'driven' (not in control / reference only) dimension.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WCrihfield_0-1652462982163.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066981i463D89ADDF0AB14A/image-size/large?v=v2&amp;amp;px=999" role="button" title="WCrihfield_0-1652462982163.png" alt="WCrihfield_0-1652462982163.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When I choose that option, the name of the dimension changes, and now shows the "(" and ")" around its name, indicating that it is now a 'driven' dimension.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WCrihfield_1-1652463025430.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066982i2D62BDCF1EA72908/image-size/large?v=v2&amp;amp;px=999" role="button" title="WCrihfield_1-1652463025430.png" alt="WCrihfield_1-1652463025430.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then if I right click on that dimension again, that option shows up in my radial menu again, but this time it already has a check mark in it, meaning that the dimension is already 'driven', so choosing this option again will toggle that setting off, making the dimension 'driven' again.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WCrihfield_2-1652463168772.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066983iF5D62D1017F9BBEF/image-size/large?v=v2&amp;amp;px=999" role="button" title="WCrihfield_2-1652463168772.png" alt="WCrihfield_2-1652463168772.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When the dimension looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WCrihfield_3-1652463211255.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066984i0F7D5D7A90C146C4/image-size/large?v=v2&amp;amp;px=999" role="button" title="WCrihfield_3-1652463211255.png" alt="WCrihfield_3-1652463211255.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;before I run the rule, then I run the rule you have there named "Length_A", it changes that dimension to looking like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WCrihfield_4-1652463273285.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1066985i6B90029B37FEAE00/image-size/large?v=v2&amp;amp;px=999" role="button" title="WCrihfield_4-1652463273285.png" alt="WCrihfield_4-1652463273285.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When it has those "(" and ")" around its name, the dimension is then a 'driven' dimension.&amp;nbsp; That's why when you get the DimensionConstraint object in the API, it has that Property called "Driven", and its value is a Boolean (True/False).&amp;nbsp; When the value of that property is set to True, that means the dimension is driven.&amp;nbsp; When its value is False, it is not driven.&amp;nbsp; Well, the code was designed to make sure the value of that Driven property of that dimension gets set to True, and it appears to be doing its job OK to me.&lt;/P&gt;
&lt;P&gt;If you would rather have the code simply 'toggle' its value, instead of always set it to True, that can easily be done too, by replacing this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;If Not oDim.Driven Then
	oDim.Driven = True
End If&lt;/LI-CODE&gt;
&lt;P&gt;with this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oDim.Driven = Not oDim.Driven&lt;/LI-CODE&gt;
&lt;P&gt;Then, if the dimension is currently driving, running the rule will toggle it to driven, and if the dimension is currently driven, running the rule will toggle it to driving.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 17:45:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-make-a-dimension-driven-using-ilogic/m-p/11167730#M37149</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-05-13T17:45:50Z</dc:date>
    </item>
  </channel>
</rss>

