<?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: Help with creating an assembly constraint with offset that uses an expression in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168335#M174248</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;/&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1104556"&gt;@Michael.Navara&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Apparently you have to post on the forum in order to find the mistake in your own code.&lt;/P&gt;&lt;P&gt;I was constraining two components in a subassembly.&lt;/P&gt;&lt;P&gt;The subassembly was being created on the fly from a template.&lt;/P&gt;&lt;P&gt;What I did not notice, until NOW, was that the 'Return_Rail_Liner_Thickness' parameter was not defined in the template.&lt;/P&gt;&lt;P&gt;I had used similar code using expressions to constrain top-level components - where the parameter WAS defined.&lt;/P&gt;&lt;P&gt;Can't constrain in a subassembly if parameter is missing. That explains why offset=0 worked, but an expression with the parameter name failed.&lt;/P&gt;&lt;P&gt;Thank you all for helping me find this embarrassing mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2024 15:20:00 GMT</pubDate>
    <dc:creator>JBerns</dc:creator>
    <dc:date>2024-11-22T15:20:00Z</dc:date>
    <item>
      <title>Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13166712#M174205</link>
      <description>&lt;P&gt;Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have searched Help, Forums, and have asked Gemini to write ilogic code, but have been unsuccessful in creating an assembly constraint that uses an expression for the offset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I have tried:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim offsetExpression As String = "Return_Rail_Liner_Thickness * -1.0 ul"
oConstraintSub = oAsmCompDef.Constraints.AddFlushConstraint(oAsmCompDef.WorkPlanes("XY Plane"), oproxyPlaneAFLXY, Offset:=offsetExpression)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message is, "The parameter is incorrect."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know the rest of the line is good because I was originally using an offset value of 0 and the constraint was created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the iLogic Editor, I used the relationship capture tool. This was the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JBerns_0-1732225231957.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1437126iB9762749101D6B14/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JBerns_0-1732225231957.png" alt="JBerns_0-1732225231957.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought it was bad practice to use parameters as shown in gold above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this - after creating the constraint with an offset of 0 (zero), I tried to edit the constraint:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oConstraintSub.Offset = offsetExpression&lt;/LI-CODE&gt;&lt;P&gt;but Inventor reports that the Offset is Read-Only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your assistance would be appreciated to create an assembly constraint using an expression for the offset.&lt;/P&gt;&lt;P&gt;If there is a reference or an example for this, I would welcome the link.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time and attention. I look forward to your replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 21:57:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13166712#M174205</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-11-21T21:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13166833#M174206</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hey Jerry hope you're doing well! This worked for me using the iLogic functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PT_100_1&lt;/SPAN&gt; = &lt;SPAN&gt;Components&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100.ipt"&lt;/SPAN&gt;, &lt;SPAN&gt;grounded&lt;/SPAN&gt; := &lt;SPAN&gt;True&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PT_300_1&lt;/SPAN&gt; = &lt;SPAN&gt;Components&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300.ipt"&lt;/SPAN&gt;)

&lt;SPAN&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddMate&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face0"&lt;/SPAN&gt;)
&lt;SPAN&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddFlush&lt;/SPAN&gt;(&lt;SPAN&gt;"Flush:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face2"&lt;/SPAN&gt;)
&lt;BR /&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;offsetExpression&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"Return_Rail_Liner_Thickness * -1.0 ul"&lt;/SPAN&gt;
&lt;SPAN&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddFlush&lt;/SPAN&gt;(&lt;SPAN&gt;"Flush:2"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face2"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face3"&lt;/SPAN&gt;,&lt;SPAN&gt;offsetExpression&lt;/SPAN&gt;)&lt;/PRE&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="Curtis_Waguespack_0-1732231850487.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1437146i7923D87F4F1CBF67/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_0-1732231850487.png" alt="Curtis_Waguespack_0-1732231850487.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 07:47:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13166833#M174206</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2024-11-22T07:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13167036#M174207</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;I noticed your line of code with the offset has more parameters as compared to mine.&lt;/P&gt;&lt;P&gt;My code was working with 0 for the offset argument, but failed when I tried to use a non-zero argument.&lt;/P&gt;&lt;P&gt;I will explore these differences tomorrow at work.&lt;/P&gt;&lt;P&gt;Thanks again for the example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 02:18:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13167036#M174207</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-11-22T02:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13167483#M174214</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason why the parameter is incorrect is that the Offset property is of type Parameter. You need to set its Expression property. See the code below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim asm As AssemblyDocument = ThisDoc.Document
Dim occ1 As ComponentOccurrence = asm.ComponentDefinition.Occurrences(1)
Dim occ2 As ComponentOccurrence = asm.ComponentDefinition.Occurrences(2)

Dim occ1WorkPlane As WorkPlane = occ1.Definition.WorkPlanes("Work Plane1")
Dim occ2WorkPlane As WorkPlane = occ2.Definition.WorkPlanes("Work Plane1")

Dim occ1WorkPlaneProxy As WorkPlaneProxy 
occ1.CreateGeometryProxy(occ1WorkPlane, occ1WorkPlaneProxy)
Dim occ2WorkPlaneProxy As WorkPlaneProxy
occ2.CreateGeometryProxy(occ2WorkPlane, occ2WorkPlaneProxy)

Dim offsetExpression1 As String = "10 mm"
Dim flushConstr As FlushConstraint = asm.ComponentDefinition.Constraints.AddFlushConstraint(occ1WorkPlaneProxy, occ2WorkPlaneProxy, offsetExpression1)

Dim offsetExpression2 As String = "20 mm"
flushConstr.Offset.Expression = offsetExpression2&lt;/LI-CODE&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>Sat, 23 Nov 2024 10:29:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13167483#M174214</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2024-11-23T10:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13167587#M174217</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;
&lt;P&gt;I noticed your line of code with the offset has more parameters as compared to mine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think the difference you're noticing is due to the use of the API function "AddFlushConstraint" vs the iLogic function "AddFlush", that do pretty much the same thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The iLogic function is what you get when you use Capture Current State.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inventor API function to create a flush constraint&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oAsmCompDef.Constraints.AddFlushConstraint(oAsmCompDef.WorkPlanes("XY Plane"), oproxyPlaneAFLXY, Offset:=offsetExpression)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;iLogic&amp;nbsp;function to create a flush constraint&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Constraints.AddFlush("Flush:2", "PT_300:1", "Face2", "PT_100:1", "Face3")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The iLogic function will accept a string as the offset value and use it as an expression, without the need to do anything else. The API function requires an extra step as&amp;nbsp;Michael.Navara's example shows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it might help to understand the difference, by understanding how to work with both functions and their resulting objects, together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do that we could do something like the example below where we add the constraint using the iLogic function, but capture it with a variable, for use later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is created as an iLogic&amp;nbsp;IManagedConstraint object. As can be seen in the tooltip by hovering over the ilogic &lt;STRONG&gt;&lt;FONT color="#993366"&gt;AddFlush&lt;/FONT&gt; &lt;/STRONG&gt;function.&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="Curtis_Waguespack_4-1732263673333.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1437344i09FFF8043690EC15/image-size/large?v=v2&amp;amp;px=999" role="button" title="Curtis_Waguespack_4-1732263673333.png" alt="Curtis_Waguespack_4-1732263673333.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This allows you to add the constraint and then access it again later to set the offset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might use something like this if I were adding components to an assembly, constraining them in place, and then using some calculation or condition later in the rule to change the location of one of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do that we just need to sort of take the mask off of the iManagedConstraint object to find the underlaying API constraint object, so that we can do API stuff&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="Curtis_Waguespack_5-1732263723667.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1437346i5749F809B7F7FFFC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Curtis_Waguespack_5-1732263723667.png" alt="Curtis_Waguespack_5-1732263723667.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might recall&amp;nbsp; this image from Autodesk University.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_Waguespack_3-1732263130068.png" style="width: 180px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1437336iB3AF0F410AB58610/image-dimensions/180x185?v=v2" width="180" height="185" role="button" title="Curtis_Waguespack_3-1732263130068.png" alt="Curtis_Waguespack_3-1732263130068.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The short version is that we can get the underlaying API object from pretty much any iLogic object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PT_100_1&lt;/SPAN&gt; = &lt;SPAN&gt;Components&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100.ipt"&lt;/SPAN&gt;, &lt;SPAN&gt;grounded&lt;/SPAN&gt; := &lt;SPAN&gt;True&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PT_300_1&lt;/SPAN&gt; = &lt;SPAN&gt;Components&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300.ipt"&lt;/SPAN&gt;)

&lt;SPAN&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddMate&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face0"&lt;/SPAN&gt;)
&lt;SPAN&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddFlush&lt;/SPAN&gt;(&lt;SPAN&gt;"Flush:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face1"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face2"&lt;/SPAN&gt;)
MyiLogicFlush = Constraints.AddFlush("Flush:2", "PT_&lt;SPAN&gt;300:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face2"&lt;/SPAN&gt;, &lt;SPAN&gt;"PT_100:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face3"&lt;/SPAN&gt;)

&lt;SPAN&gt;'some other code here, to do stuff, with things&lt;/SPAN&gt;
&lt;SPAN&gt;'some other code here, to do stuff, with things&lt;/SPAN&gt;
&lt;SPAN&gt;'some other code here, to do stuff, with things&lt;/SPAN&gt;
&lt;BR /&gt;'get the API constraint object from the iLogic constraint object
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;o&lt;/SPAN&gt;Flush As FlushConstraint = MyiLogicFlush.Constraint
&lt;BR /&gt;'define the offset expression
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;offsetExpression&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"Return_Rail_Liner_Thickness * -1.0 ul"&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;'set the expression
&lt;SPAN&gt;oFlush&lt;/SPAN&gt;.&lt;SPAN&gt;Offset&lt;/SPAN&gt;.&lt;SPAN&gt;Expression&lt;/SPAN&gt; = &lt;SPAN&gt;offsetExpression&lt;/SPAN&gt;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 08:33:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13167587#M174217</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2024-11-22T08:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168119#M174243</link>
      <description>Curtis,&lt;BR /&gt;I noticed the difference between our code.&lt;BR /&gt;I was constraining work planes of two parts with an offset=0.&lt;BR /&gt;When I wanted to use a string expression instead of 0, that is when the error appeared.</description>
      <pubDate>Fri, 22 Nov 2024 13:48:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168119#M174243</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-11-22T13:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168287#M174245</link>
      <description>Michael,&lt;BR /&gt;On line 6, just had to change 'occ1' to 'occ2'.&lt;BR /&gt;Works great!</description>
      <pubDate>Fri, 22 Nov 2024 14:54:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168287#M174245</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-11-22T14:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168335#M174248</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;/&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1104556"&gt;@Michael.Navara&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Apparently you have to post on the forum in order to find the mistake in your own code.&lt;/P&gt;&lt;P&gt;I was constraining two components in a subassembly.&lt;/P&gt;&lt;P&gt;The subassembly was being created on the fly from a template.&lt;/P&gt;&lt;P&gt;What I did not notice, until NOW, was that the 'Return_Rail_Liner_Thickness' parameter was not defined in the template.&lt;/P&gt;&lt;P&gt;I had used similar code using expressions to constrain top-level components - where the parameter WAS defined.&lt;/P&gt;&lt;P&gt;Can't constrain in a subassembly if parameter is missing. That explains why offset=0 worked, but an expression with the parameter name failed.&lt;/P&gt;&lt;P&gt;Thank you all for helping me find this embarrassing mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 15:20:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168335#M174248</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-11-22T15:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168362#M174249</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;, I just thought of something...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... make sure that&amp;nbsp;&lt;SPAN&gt;'Return_Rail_Liner_Thickness' parameter is defined in the template!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@9E6C021AF25E3AB87C9F241086322408/emoticons/1f602.png" alt=":face_with_tears_of_joy:" title=":face_with_tears_of_joy:" /&gt;&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@108A86EAEBDCD23B42C9DA513E42C4E6/emoticons/1f923.png" alt=":rolling_on_the_floor_laughing:" title=":rolling_on_the_floor_laughing:" /&gt;&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@229C3571CF8D0728512C26B0AE81ABAC/emoticons/1f60b.png" alt=":face_savoring_food:" title=":face_savoring_food:" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The thing I do all the time is try to use part of a file name, and I get everything working, and then I do some testing using and unsaved file, hit the error because the name is nothing, and spend way too much time trying to figure it out.... almost every time&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B6AC3F32F1BFC562FB175E3DCDFB45A6/emoticons/1f643.png" alt=":upside_down_face:" title=":upside_down_face:" /&gt;&lt;/SPAN&gt;&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="Curtis_Waguespack_0-1732289139513.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1437492i2BCF12EE84CFD122/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_0-1732289139513.png" alt="Curtis_Waguespack_0-1732289139513.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 15:31:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168362#M174249</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2024-11-22T15:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168388#M174250</link>
      <description>Curtis,&lt;BR /&gt;I have added code to ensure the parameter is present in the template.&lt;BR /&gt;I enjoyed the TGIF image.&lt;BR /&gt;Regards,&lt;BR /&gt;Jerry</description>
      <pubDate>Fri, 22 Nov 2024 15:45:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168388#M174250</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-11-22T15:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168512#M174254</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Curtis,&lt;BR /&gt;I have added code to ensure the parameter is present in the template.&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I was just trying to be goofy, by saying the thing that you discovered as if it was my epiphany&amp;nbsp; ( a poor attempt at dry humor on a forum) .&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B6AC3F32F1BFC562FB175E3DCDFB45A6/emoticons/1f643.png" alt=":upside_down_face:" title=":upside_down_face:" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 16:53:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13168512#M174254</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2024-11-22T16:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13169598#M174263</link>
      <description>Ooops! Code sample was fixed. &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;</description>
      <pubDate>Sat, 23 Nov 2024 10:30:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13169598#M174263</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2024-11-23T10:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating an assembly constraint with offset that uses an expression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13172436#M174287</link>
      <description>&lt;P&gt;Simply way too add experssion too constraints&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddMate&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Part2:1"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face0"&lt;/SPAN&gt;, &lt;SPAN&gt;"Part2:2"&lt;/SPAN&gt;, &lt;SPAN&gt;"Face1"&lt;/SPAN&gt;,
                   &lt;SPAN&gt;oOffset&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"Offset = Width"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Best Regards Johan G&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 14:22:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-with-creating-an-assembly-constraint-with-offset-that-uses/m-p/13172436#M174287</guid>
      <dc:creator>JMGunnar</dc:creator>
      <dc:date>2024-11-25T14:22:54Z</dc:date>
    </item>
  </channel>
</rss>

