<?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 convert decimal to fraction in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369069#M64458</link>
    <description>&lt;P&gt;Hi frank,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'variables/values that would come from the model
Material = "Steel"
Thickness = .125
Width = 1.5
Length = 6.25

'convert values to fraction
oT = FormatAsFraction(Thickness)
oW = FormatAsFraction(Width)
oL = FormatAsFraction(Length)

'set description
iProperties.Value("Project", "Description") = _
oT &amp;amp; " " &amp;amp; Material &amp;amp; " x " &amp;amp; oW &amp;amp; " in. x " &amp;amp; oL &amp;amp; " in. Lg."

'display to user
MessageBox.Show("Description: " &amp;amp; vbLf &amp;amp; _
iProperties.Value("Project", "Description"), "iLogic")
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&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 href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jun 2016 22:01:46 GMT</pubDate>
    <dc:creator>Curtis_Waguespack</dc:creator>
    <dc:date>2016-06-06T22:01:46Z</dc:date>
    <item>
      <title>iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6368919#M64457</link>
      <description>&lt;P&gt;Happy Monday All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So Neil helped me to string together part descriptions in iLogic and pass them to the description field in iProperties.&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #800080; font-weight: bold;"&gt;iProperties&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-weight: bold;"&gt;Value&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;Project&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;Description&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: bold;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: #000000; font-weight: bold;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Thickness&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Material&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt; x &lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Width&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt; in. x &lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;Length&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000; font-weight: bold;"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt; in. Lg.&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;My question now is can I have the values displayed in the "Description" field as fractions instead of decimal values and how would my code read. I found the "FormatAsFraction" function under the "String" snippets but can't seem to get the syntax right. Thanks to all for you patience and assistance. Have a great week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 20:22:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6368919#M64457</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-06T20:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369069#M64458</link>
      <description>&lt;P&gt;Hi frank,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'variables/values that would come from the model
Material = "Steel"
Thickness = .125
Width = 1.5
Length = 6.25

'convert values to fraction
oT = FormatAsFraction(Thickness)
oW = FormatAsFraction(Width)
oL = FormatAsFraction(Length)

'set description
iProperties.Value("Project", "Description") = _
oT &amp;amp; " " &amp;amp; Material &amp;amp; " x " &amp;amp; oW &amp;amp; " in. x " &amp;amp; oL &amp;amp; " in. Lg."

'display to user
MessageBox.Show("Description: " &amp;amp; vbLf &amp;amp; _
iProperties.Value("Project", "Description"), "iLogic")
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&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 href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 22:01:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369069#M64458</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2016-06-06T22:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369079#M64459</link>
      <description>&lt;P&gt;Or something like this if you need to control the precision:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'variables/values that would come from the model
Material = "Steel"
Thickness = 0.103587
Width = 1.5625
Length = 6.3987

'convert values to fraction
oT = RoundToFraction(Thickness, 1/8, RoundingMethod.RoundUp)
oW = RoundToFraction(Width, 1/16, RoundingMethod.RoundUp)
oL = RoundToFraction(Length, 1/32, RoundingMethod.RoundUp)

'set description
iProperties.Value("Project", "Description") = _
oT &amp;amp; " " &amp;amp; Material &amp;amp; " x " &amp;amp; oW &amp;amp; " in. x " &amp;amp; oL &amp;amp; " in. Lg."

'display to user
MessageBox.Show("Description: " &amp;amp; vbLf &amp;amp; _
iProperties.Value("Project", "Description"), "iLogic")
&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 22:05:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369079#M64459</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2016-06-06T22:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369967#M64481</link>
      <description>&lt;P&gt;Curtis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second example worked like a charm once I got the syntax correct. I really appreciate the assistance. I've watched all the tutorial videos I could on iLogic and couldn't put it together until I saw it applied to what I was doing. All of the stuff in the videos was all theoretical and kind of abstract to me. I think for myself, it all started to come together when I saw it applied to what I'm doing. Thanks again for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 11:56:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/6369967#M64481</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-07T11:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/7860103#M82047</link>
      <description>&lt;P&gt;How do you do all this in VBA since if you use RoundToFraction(Variable,1/64, RoundingMethod.Round) it throws an error that the Function isn't defined.&lt;/P&gt;&lt;P&gt;Any insight anyone?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 15:37:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/7860103#M82047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-16T15:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/7875805#M82325</link>
      <description>&lt;P&gt;You stick to VB.net or iLogic or create your own function in VBA?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/706468/how-can-i-convert-a-decimal-to-a-fraction" target="_blank"&gt;https://stackoverflow.com/questions/706468/how-can-i-convert-a-decimal-to-a-fraction&lt;/A&gt;&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>Thu, 22 Mar 2018 16:57:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/7875805#M82325</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-22T16:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic convert decimal to fraction</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/7889048#M82649</link>
      <description>&lt;P&gt;The other option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Set your parameters up as "Exposed" and use the Custom Property Format to set the unit display as desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Revise your code to look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;iProperties.Value("Project", "Description") = "=" &amp;amp; "&amp;lt;Thickness&amp;gt; &amp;lt;Material&amp;gt; x &amp;lt;Width&amp;gt; in. x &amp;lt;Length&amp;gt; Lg."&lt;/PRE&gt;
&lt;P&gt;This utilizes the iProperty expressions (which will show up beside the iProperty as "fx")&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 21:12:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-convert-decimal-to-fraction/m-p/7889048#M82649</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2018-03-27T21:12:05Z</dc:date>
    </item>
  </channel>
</rss>

