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

Rounding error or decimal place problem?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
skintsubby
708 Views, 5 Replies

Rounding error or decimal place problem?

Probably a really stupid question but.....

 

I have the following code:- which picks a point, separates the x & y co-ords then converts then to a string, which I use later

 

(setq targetpoint (getpoint "\nPlease enter target point?"));where are you looking at?
(setq xvalue (rtos (nth 0 targetpoint ) 2 3))
(setq yvalue (rtos (nth 1 targetpoint ) 2 3))
(setq easting (strcat xvalue "mE"))
(setq northing (strcat yvalue "mN"))

 

But I need it to always return the result to 3 decimal places. When I pick a point that is exact the easting and northing variable returns to 0 decimal places Ie if I pick 50000.567, 809333.000 It returns 50000.567mE, 809333mN

 

LUPREC is 3 and LUINTS is 2

 

Thanks for looking

 

Mark

5 REPLIES 5
Message 2 of 6
pbejse
in reply to: skintsubby

DIMZIN 0 OR 3..

 

 

Controls the suppression of zeros in the primary unit value. Values 0-3 affect feet-and-inch dimensions only.
0 Suppresses zero feet and precisely zero inches
 
1 Includes zero feet and precisely zero inches
 
2 Includes zero feet and suppresses zero inches
 
3 Includes zero inches and suppresses zero feet
 
4 Suppresses leading zeros in decimal dimensions (for example, 0.5000 becomes .5000)
 
8 Suppresses trailing zeros in decimal dimensions (for example, 12.5000 becomes 12.5)
 
12 Suppresses both leading and trailing zeros (for example, 0.5000 becomes .5)

Message 3 of 6
skintsubby
in reply to: pbejse

pbejse.

 

Thanks.

 

Worked a treat! Smiley Very Happy

 

Mark

Message 4 of 6
pbejse
in reply to: skintsubby


@skintsubby wrote:

pbejse.

 

Thanks.

 

Worked a treat! Smiley Very Happy

 

Mark


Glad i could help

 

Cheers

 

 


 

Message 5 of 6
stevor
in reply to: skintsubby

Seems to work, meaning that it includes the specified charaters, '000', in Acad 2000.

What version id you find this condition; and what is the actual code and repsonses?

 

S
Message 6 of 6
skintsubby
in reply to: stevor

DIMZIN was set to 8 on the drawing. In AutoCAD 2012.

 

Hence the suppresion of the zero

 

A quick setvar and It works fine now.

 

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

Post to forums  

Autodesk Design & Make Report

”Boost