.NET

.NET

Reply
Distinguished Contributor
JanetDavidson
Posts: 141
Registered: ‎08-23-2011
Message 1 of 13 (1,046 Views)
Accepted Solution

Imperial input from user in Foot Inch .

1046 Views, 12 Replies
08-30-2011 07:32 PM

I really I got confused  - Hope somebody could give me a hand .  I have a form with some textbox on it, which should be

filled in with imperial dimension. Like foot and inch.  Users right now complain about it is not user friendly  ,to put data in form, and honestly they are right. I didn't a good job .

Some people like to put vetting in inch and then by the time textbox lost it focus it should automatically convert data to feet-inch format. Some other user like to put decimal I have to be able to should them in  1/8 inch.

some user like to use space as separator between foot and inch and some other like to use dash.

Bottom line I stocked. Is there any function for this in autocad ?

when I look at my code I just struggled with pure string. I thought maybe there is something in autocad which give developer this option. Like the way we input dimension in command prompt.

Any Advice or tip would be appreciated already.

Janet.

 

Autodesk.AutoCAD.Runtime.Converter.DistanceToString(Dist as double, units as DistanceUnitFormat, precision as integer) as string

BTW,  It won't do any good for Mike's microstation example (10..1 1/2) because it requires a Double, but it would turn 121.5 into (10'-1 1/2")

Distinguished Mentor
michael.robertson
Posts: 604
Registered: ‎03-18-2008
Message 2 of 13 (1,029 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 05:55 AM in reply to: JanetDavidson

I looked into something like this about 2 years ago because our MicroStation user really don't like the foot/inch input method in AutoCAD. ADN support said there's nothing built in.

 

MicroStation's input method handles feet, inches, and fractions all from the number pad. 10'-1 1/2" inches is entered as:

10..1 1/2

 

Makes it real easy with out having to hit the alpha keys on the keyboard.

 

If AutoCAD has any input method like this I would really love to hear about it also.

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer
Distinguished Contributor
JanetDavidson
Posts: 141
Registered: ‎08-23-2011
Message 3 of 13 (1,024 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 06:18 AM in reply to: michael.robertson

Mike ,

Thanks for heads up. I am pretty sure some people wrote something about it. Just it is a matter of sharing experiences.

At least now I know I should not look into object browser. I have to try to write it down from scratch unless somebody wrote it already.

 

Regards,

Janet.

 

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 4 of 13 (1,008 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 10:51 AM in reply to: JanetDavidson

Autodesk.AutoCAD.Runtime.Converter.DistanceToString(Dist as double, units as DistanceUnitFormat, precision as integer) as string

Dave O.                                                                  Sig-Logos32.png
Distinguished Contributor
JanetDavidson
Posts: 141
Registered: ‎08-23-2011
Message 5 of 13 (1,000 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 12:07 PM in reply to: chiefbraincloud

Thanks Chief,

First I didn't know about this at all. Really appreciated.

But the question is how you cotrol user input on a from  data entry , Not at command prompt ?

Regards,

Janet.

 

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 6 of 13 (993 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 12:22 PM in reply to: JanetDavidson

That is what it is for.  It won't work at a command line prompt unless you always allow Arbitrary input and parse the result autocad gives you.

 

You need to handle the .Leave event on the TextBox control (or whatever control your users are entering the length information), then pass the (numeric) string from the control to the Converter function and replace the controls text with the text returned by the converter.

Dave O.                                                                  Sig-Logos32.png
Distinguished Contributor
JanetDavidson
Posts: 141
Registered: ‎08-23-2011
Message 7 of 13 (989 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 12:49 PM in reply to: chiefbraincloud

:womanwink:

Got you. I will try and let you know in a few hours.

Thanks chief.

Hope Mike is reading this as well.

Regards,

Janet.

 

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 8 of 13 (985 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 12:54 PM in reply to: JanetDavidson

BTW,  It won't do any good for Mike's microstation example (10..1 1/2) because it requires a Double, but it would turn 121.5 into (10'-1 1/2")

Dave O.                                                                  Sig-Logos32.png
Distinguished Contributor
JanetDavidson
Posts: 141
Registered: ‎08-23-2011
Message 9 of 13 (974 Views)

Re: Imperial input from user in Foot Inch .

08-31-2011 05:32 PM in reply to: chiefbraincloud

Chief , it is  working like a charm. Yeaaaaaaaaaaaaaaaaaah!!

I almost wrote 150 lines of code to do that and still buggy.

Really appreciated.

Without you guys here I should've been fired by far. :womansurprised:

Regards, and all the best

Janet.

 

*Expert Elite*
Keith.Brown
Posts: 1,236
Registered: ‎03-13-2008
Message 10 of 13 (906 Views)

Re: Imperial input from user in Foot Inch .

01-22-2012 06:51 AM in reply to: chiefbraincloud

chiefbraincloud wrote:

Autodesk.AutoCAD.Runtime.Converter.DistanceToString(Dist as double, units as DistanceUnitFormat, precision as integer) as string


Can anyone explain how the integers relate to precision?  I mean does a 1 mean 1/2" precision, a 2 mean 1/4" precision, etc? 

 

How can I make it the same as the precision specified in the units dialog?

 

Thanks in Advance


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!
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
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.