<?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: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026541#M153809</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3950322"&gt;@chris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would need to have a dimension in a sketch and have it set to driven. Or have a parameter derived from another part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1686536447832.png" style="width: 840px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1226143i97E2582ABFA16C8B/image-dimensions/840x49?v=v2" width="840" height="49" role="button" title="AAcheson_0-1686536447832.png" alt="AAcheson_0-1686536447832.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this is just a calculation you could just leave it in the code or make a comment to say what the user needs to do E.G do not touch. Unfortunately there is no way to make it read only if I understand your intention.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2023 02:28:17 GMT</pubDate>
    <dc:creator>A.Acheson</dc:creator>
    <dc:date>2023-06-12T02:28:17Z</dc:date>
    <item>
      <title>what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12024937#M153798</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chris_0-1686421120178.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1225922iA139157323FF1131/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chris_0-1686421120178.png" alt="chris_0-1686421120178.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 18:18:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12024937#M153798</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2023-06-10T18:18:46Z</dc:date>
    </item>
    <item>
      <title>Betreff: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026111#M153805</link>
      <description>&lt;P&gt;Why should this be a reference parameter? You can write the value in a Text type custom parameter. Or into a custom iProperty.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 19:04:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026111#M153805</guid>
      <dc:creator>martin_winkler</dc:creator>
      <dc:date>2023-06-11T19:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026294#M153807</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2181124"&gt;@martin_winkler&lt;/a&gt;&amp;nbsp;Okay, I was just trying to get it as something I could then reference in parameters. this code, in its current form, only gives me a message answer I just wanted to be able to use the answer in formulas&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 22:31:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026294#M153807</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2023-06-11T22:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026541#M153809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3950322"&gt;@chris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would need to have a dimension in a sketch and have it set to driven. Or have a parameter derived from another part.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1686536447832.png" style="width: 840px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1226143i97E2582ABFA16C8B/image-dimensions/840x49?v=v2" width="840" height="49" role="button" title="AAcheson_0-1686536447832.png" alt="AAcheson_0-1686536447832.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this is just a calculation you could just leave it in the code or make a comment to say what the user needs to do E.G do not touch. Unfortunately there is no way to make it read only if I understand your intention.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 02:28:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12026541#M153809</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-06-12T02:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12027940#M153838</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3950322"&gt;@chris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edit: see&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;'s post below to add a reference parameter&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;To make it a reference dimension, I think you would need to have or add a sketch dimension and set it to be driven. &lt;/STRIKE&gt;&lt;STRIKE&gt;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To pass the result to a user parameter, you could use something like this to look for the parameter and create it if not found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;num1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Double&lt;/SPAN&gt; = 7
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;num2&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Double&lt;/SPAN&gt; = 9
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oResult&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Double&lt;/SPAN&gt; = &lt;SPAN&gt;Math&lt;/SPAN&gt;.&lt;SPAN&gt;Sqrt&lt;/SPAN&gt;(&lt;SPAN&gt;num1&lt;/SPAN&gt; + &lt;SPAN&gt;num2&lt;/SPAN&gt;)
&lt;SPAN&gt;oName&lt;/SPAN&gt; = &lt;SPAN&gt;"My_SQRT_Result"&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oUserParams&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;UserParameters&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kDrawingDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;oUserParams&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;UserParameters&lt;/SPAN&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;oUserParams&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;UserParameters&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTest&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;""&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt; : &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;oName&lt;/SPAN&gt;) = &lt;SPAN&gt;oResult&lt;/SPAN&gt; : &lt;SPAN&gt;Catch&lt;/SPAN&gt; : &lt;SPAN&gt;oTest&lt;/SPAN&gt; = &lt;SPAN&gt;"not found"&lt;/SPAN&gt; : &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oTest&lt;/SPAN&gt; = &lt;SPAN&gt;"not found"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;oUserParams&lt;/SPAN&gt;.&lt;SPAN&gt;AddByValue&lt;/SPAN&gt;(&lt;SPAN&gt;oName&lt;/SPAN&gt;, &lt;SPAN&gt;oResult&lt;/SPAN&gt;, &lt;SPAN&gt;UnitsTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kUnitlessUnits&lt;/SPAN&gt;)
	&lt;SPAN&gt;'oUserParams.AddByValue(oName, oResult, UnitsTypeEnum.kInchLengthUnits)&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;'assumes Length is an inch based parameter&lt;/SPAN&gt;
&lt;SPAN&gt;'use * 1 in to convert untiless to inches&lt;/SPAN&gt;
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;.&lt;SPAN&gt;Param&lt;/SPAN&gt;(&lt;SPAN&gt;"Length"&lt;/SPAN&gt;).&lt;SPAN&gt;Expression&lt;/SPAN&gt; =  &lt;SPAN&gt;oName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"* 1 in"&lt;/SPAN&gt; 
&lt;SPAN&gt;InventorVb&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentUpdate&lt;/SPAN&gt;()
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 17:09:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12027940#M153838</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2023-06-12T17:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12028001#M153839</link>
      <description>&lt;P&gt;Or add it to 'User Parameter'&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 14:50:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12028001#M153839</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2023-06-12T14:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: what would I need to add to this iLogic code to make the answer show up in the parameters as a reference dimension?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12028212#M153844</link>
      <description>&lt;P&gt;If a reference parameter is wanted, why not just create one directly, using the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ReferenceParameters_AddByValue" target="_blank" rel="noopener"&gt;ReferencedParameters.AddByValue&lt;/A&gt; or &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ReferenceParameters_AddByExpression" target="_blank" rel="noopener"&gt;ReferenceParameters.AddByExpression&lt;/A&gt; methods?&amp;nbsp; This seems like the simplest, and most direct way of doing what was asked for in the original post.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oPDoc As PartDocument = ThisDoc.Document
Dim RParams As ReferenceParameters = oPDoc.ComponentDefinition.Parameters.ReferenceParameters
RParams.AddByExpression("123.456 in", "in", "MyRefParam")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 16:21:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/what-would-i-need-to-add-to-this-ilogic-code-to-make-the-answer/m-p/12028212#M153844</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-06-12T16:21:05Z</dc:date>
    </item>
  </channel>
</rss>

