PDA

View Full Version : Getpoint to file


kennet.sjoberg
2008-11-25, 03:34 PM
Assume that you pick a large coordinate point by getpoint
(1.56451e+009 6.83952e+009 0.0)
I need to write the coordinate with full precision to an ASCII text file without the e+009 like this
(1564514586.0 6839518194.0 0.0)

How do I manage it ?


: ) Happy Computing !

kennet

not ("1564514586.0" "6839518194.0" "0.0") or similar

tedg
2008-11-25, 03:39 PM
Assume that you pick a large coordinate point by getpoint
(1.56451e+009 6.83952e+009 0.0)
I need to write the coordinate with full precision to an ASCII text file without the e+009 like this
(1564514586.0 6839518194.0 0.0)

How do I manage it ?


: ) Happy Computing !

kennet

not ("1564514586.0" "6839518194.0" "0.0") or similar
Hi kennet..... changing from engineering units to decimal units doesn't do it?

** edit ** I guess not, I just checked, even if you're in decimal units you get the engineering coords.

kennet.sjoberg
2008-11-25, 08:08 PM
Assume that you pick a large coordinate point by getpoint
(1.56451e+009 6.83952e+009 0.0)
I need to write the coordinate with full precision to an ASCII text file without the e+009 like this
(1564514586.0 6839518194.0 0.0)

How do I manage it ?


: ) Happy Computing !

kennet

not ("1564514586.0" "6839518194.0" "0.0") or similar

I am in decimal mode.

Tom Beauford
2008-11-25, 09:16 PM
Try:
(setq pt (getpoint) str (strcat (rtos (car pt) 2 1) " " (rtos (cadr pt) 2 1) " " (rtos (caddr pt) 2 1)))

No matter how they're displayed Autocad's precision is the same. You need to use "rtos" to convert to the mode and precision you want for your ASCII text file.

kennet.sjoberg
2008-11-25, 10:13 PM
Try:
(setq pt (getpoint) str (strcat (rtos (car pt) 2 1) " " (rtos (cadr pt) 2 1) " " (rtos (caddr pt) 2 1)))

No matter how they're displayed Autocad's precision is the same. You need to use "rtos" to convert to the mode and precision you want for your ASCII text file.
Thank you Tom, you rescue me again. I can not understand why I didn't got it to work earlier when I wrote it to a file.
So I wrote the same as you did, but longer :lol:

(foreach Item_in
(vl-string->list (vl-princ-to-string (strcat "(" (rtos (car Pkt ) 2 16 ) " " (rtos (cadr Pkt ) 2 16 ) " " (rtos (caddr Pkt ) 2 16 ) ")" )))
(princ (chr Item_in ) File#1 )
)

But your code works well, if I set higher precision.


Thanks again Tom and . .
: ) Happy Computing !

kennet