<?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: Parameter to have leading and ending zeros in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728234#M133255</link>
    <description>&lt;P&gt;Curtis I swear you are thee MAN.......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much. I never thought of using the same thing I use in excel..&lt;/P&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Dec 2012 21:09:36 GMT</pubDate>
    <dc:creator>jletcher</dc:creator>
    <dc:date>2012-12-07T21:09:36Z</dc:date>
    <item>
      <title>Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3727554#M133251</link>
      <description>&lt;P&gt;I have a client that wants the part number to be driven by size with a catch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope I can explain it for all to understand. I have it some what working but need some guidance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The part number goes like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;625A3-A01.000M0.500 or 625A3-A10.000M1.000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;625A3 = Profile Threaded or unthreaded rod&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A= material type A-Mild Steel, B-Ground and polish rod, C-Stainless steel and so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;01.000&amp;nbsp;is the Length of the part (this is an issue will explain at bottom)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M= thread code&amp;nbsp; K-no tapping, L-10-32 UNC, M-1/4-20 UNC, N- 5/16-18 and so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.500= Diameter of rod ( nothing bigger than 9 inches)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok I have everything working but the Length the issue with this is the leading and trailing zeros and extra..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the length is 1/2 inch the number needs to show as 00.5000 if it is 1 inch needs to show as 01.000 if it was 10&amp;nbsp;inches it needs to show like 10.000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now this is the problem I am having if it is 1/2 I get this 0.500 but I need that extra 0 in the front like 00.500.&lt;/P&gt;&lt;P&gt;I am also having issues when the number is 4 inches or a rounded number 10,9,5 no matter if I have the parameter set to show trailing zeros it seems to work and not work so I get 4 and not 4.000 even in this I would have to get ilogic to add a zero to it like 04.000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get ilogic to look at the number of characters in the Length and if it is less than the what I need add the others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope I explained it for all to understand. If not ask away and I will try to expain more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have been trying but I am failing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If LENGTH &amp;gt;= Len(5) Then
	Parameter("L_1") = "0" &amp;amp; LENGTH &amp;amp; ".000"
Else
	Parameter("L_1") = LENGTH
End If


iProperties.Value("Project", "Part Number")= "625A3-" &amp;amp; Mat_Code &amp;amp; L_1 &amp;amp; Tap_Code &amp;amp; Rod&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2012 14:37:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3727554#M133251</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-12-07T14:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3727686#M133252</link>
      <description>&lt;P&gt;I added this to try to get the trailing zeros to show but still no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Parameter("L_1") = "0" &amp;amp; Round(LENGTH,3)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2012 15:53:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3727686#M133252</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-12-07T15:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728140#M133253</link>
      <description>&lt;P&gt;Hello, is there any body out there........ Pink floyd &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2012 19:59:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728140#M133253</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-12-07T19:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728180#M133254</link>
      <description>&lt;P&gt;Hi jletcher,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming this is being done via ilogic, you can use something along these lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;iLogicOption DoubleForEquals Off
sL_1 = Format(L_1, "00.000")
sRod = Format(Rod, "00.000")
iProperties.Value("Project", "Part Number") = "625A3-" &amp;amp; Mat_Code &amp;amp; sL_1 &amp;amp; Tap_Code &amp;amp; sRod&lt;/PRE&gt;&lt;P&gt;see this link for more on the VB Format function:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://msdn.microsoft.com/en-US/library/59bz1f0h%28v=vs.80%29.aspx"&gt;http://msdn.microsoft.com/en-US/library/59bz1f0h%28v=vs.80%29.aspx&lt;/A&gt;&lt;/P&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 target="_blank" href="http://inventortrenches.blogspot.com"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2012 20:22:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728180#M133254</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2012-12-07T20:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728234#M133255</link>
      <description>&lt;P&gt;Curtis I swear you are thee MAN.......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much. I never thought of using the same thing I use in excel..&lt;/P&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2012 21:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/3728234#M133255</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-12-07T21:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4311649#M133256</link>
      <description>&lt;P&gt;I have a problem ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my value is 0,0125 and when is rounding becoming at 0,012 but not true?&lt;/P&gt;&lt;P&gt;the good result for me is 0,013&lt;/P&gt;&lt;P&gt;this is my rule&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE =&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;0,0125&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;CODE2 = Round(CODE,3)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thamks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2013 15:37:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4311649#M133256</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-27T15:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4319812#M133257</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm quite sure that this is because of the underlying .NET behaviour. You can read about that on various sites:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/977796/why-does-math-round2-5-return-2-instead-of-3-in-c" target="_self"&gt;http://stackoverflow.com/questions/977796/why-does-math-round2-5-return-2-instead-of-3-in-c&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could use the .NET function directly to round away from zero instead of to even:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;MsgBox&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Math&lt;SPAN&gt;.&lt;/SPAN&gt;Round&lt;SPAN&gt;&lt;STRONG&gt;(0.0125&lt;/STRONG&gt;, &lt;STRONG&gt;3&lt;/STRONG&gt;, &lt;/SPAN&gt;MidpointRounding&lt;SPAN&gt;.&lt;/SPAN&gt;AwayFromZero&lt;SPAN&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;This will give you 0.013&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2013 19:41:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4319812#M133257</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2013-07-04T19:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4320293#M133258</link>
      <description>&lt;P&gt;thanks you for your help Adam, i try that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2013 09:40:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4320293#M133258</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-05T09:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4320313#M133260</link>
      <description>&lt;P&gt;all the time 0,013 now &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; with any number???&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2013 10:02:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4320313#M133260</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-05T10:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter to have leading and ending zeros</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4320412#M133261</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;A target="_self" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1050187"&gt;sergelachance&lt;/A&gt;, you might want to start a new thread - I have a feeling you have other conditions in your code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2013 12:41:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-to-have-leading-and-ending-zeros/m-p/4320412#M133261</guid>
      <dc:creator>jdkriek</dc:creator>
      <dc:date>2013-07-05T12:41:04Z</dc:date>
    </item>
  </channel>
</rss>

