Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Decimal To Fraction

3 REPLIES 3
Reply
Message 1 of 4
Zanzabar
926 Views, 3 Replies

Decimal To Fraction

Hello Everyone have an issue and cant seem to find a solution for it. Basically I need to take a Decimal and turn it into a Fraction, I have been trying to use (rtos 5 3) but it doesnt seem to want to work, the number that I am trying to convert for the example that I am working on is .401 and I want it to round to 3/8" but instead I keep getting 5". I have figured out that it is thinking that .401 is in feet but I cant seem to figure out how to make it think that it is in inches and in which case make it a fraction. I havent tried messing around with the system variable that much but realize that maybe it has something to do with DIMZIN, LUNITS, or LUPREC or atleast that is what I am finding all over the forums and in the help. I would love some help with this and hope to hear back from you soon.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Zanzabar

That's because you are asking it to convert 5 to a string. Add the number you want to convert in
there:

Command: (rtos 0.401 5 3)
"3/8"

--
Kent Cooper


Zanzabar wrote...
Hello Everyone have an issue and cant seem to find a solution for it. Basically I need to take a
Decimal and turn it into a Fraction, I have been trying to use (rtos 5 3) but it doesnt seem to want
to work, the number that I am trying to convert for the example that I am working on is .401 and I
want it to round to 3/8" but instead I keep getting 5". I have figured out that it is thinking that
.401 is in feet but I cant seem to figure out how to make it think that it is in inches and in which
case make it a fraction. I havent tried messing around with the system variable that much but
realize that maybe it has something to do with DIMZIN, LUNITS, or LUPREC or atleast that is what I
am finding all over the forums and in the help. I would love some help with this and hope to hear
back from you soon.
Message 3 of 4
lpseifert
in reply to: Zanzabar

try (rtos 0.404 4 4)
~~~Civil 3D 2008~~~
Message 4 of 4
Zanzabar
in reply to: Zanzabar

O man I guess sometimes you just get caught up in the code and forget what you are doing or how it all works out in the end. Thanks guys

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost