*Expert Elite*
Posts: 1,236
Registered: ‎03-13-2008
Message 11 of 13 (222 Views)

Re: Imperial input from user in Foot Inch .

01-22-2012 07:23 AM in reply to: Keith.Brown

Ok, I think I figured it out.  the integer required should be the denominator of the fraction of the precision required.  For example, 1/4" precision would require the integer 4 and 1/256" precision would require the integer 256.


If you want to use the drawing units,   just use:


Autodesk.AutoCAD.Runtime.Converter.DistanceToStrin​g(Dist as double) as string



Keith Brown AutoCAD MEP BLOG | RSS Feed
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
Distinguished Contributor
Posts: 170
Registered: ‎09-26-2008
Message 12 of 13 (211 Views)

Re: Imperial input from user in Foot Inch .

01-22-2012 08:58 PM in reply to: JanetDavidson

I had a similar situation once.  I found that the best solution was using Regular Expressions.  That way you can parse whatever the user puts in your text box.  In my case I restricted the units to inches, but they where free to write some like 10'-1 5/16", 5/32", 10" or 8.75".  

Valued Contributor
Posts: 59
Registered: ‎12-08-2010
Message 13 of 13 (138 Views)

Re: Imperial input from user in Foot Inch .

04-17-2013 03:31 PM in reply to: Keith.Brown

Recently I used Converter.DistanceToString method and I would like to clarify two points for others.

1) Precision is integer from 0 to 8 (LUPREC equivalent). E.g. 1/4" is 2.

2) This method return value affected by AutoCAD variable DIMZIN. This variable controls suppression of zero. You have to temporary change it to your needs and then revers it back.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.