• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

control of decimals

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
I can't prevent this code, in one of the two cases, instead of writing the ray value1 or ray2, writes the right value with a series of 12 zeros with a "1" final.
Code:
(while)
(setq fp2 (open "c:\\\\autocadsupporto\\\intersezione\\\distanze.dat" "r"))
(setq ray1 (read-line fp2); 4.52
(setq ray2 (read-line fp2); 3.98
(setq point name (read-line fp2))
(close fp)
);

(setq pointdimezzo1 (list (/ (+ (car point1)) (car side)) 2.0) (/ (+ (cadr point1) (side) 2.0)))
(command "_text" "_j" "_mc" dot1 0.20 0.0 (atof ray1) ")

(setq pointdimezzo2 (list (/ (+ (car point2) (car side)) 2.0) (/ (+ (cadr point2) (cadr side) 2.0)))
(command "_text" "_j" "_mc" pointdimezzo2 0.20 0.0 (atof ray2) "")
What can I do to avoid this inconvenience?
Thank you.
 
simply by writing the transformation into string value of the number:
(rtos) 2 3)
where 2 identifies decimal type number
3 the number of decimals
 
thanks rpor66
the solution of problems is always the simplest, just know it!
Thanks again rpor66, you are great.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top