TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mailmaverick on July 04, 2016, 06:56:29 AM
-
Hi
When I use (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint BLOCKOBJ))), I get insertion point without decimals.
For example I get (432961.0 2.9347e+006 0.0)
Whereas actual point is : (432960.54137899 2934700.28511465 0.0)
Why dont i get insertion point with decimals ?
I have tried with "DIMZIN 0 & 15" and "LUPREC 0 & 8".
I have even tried (cdr (assoc 10 (entget BLOCKENT))) but I still get result without decimals.
Please help. When I do Right Click -> Properties on the block, I get following properties :-
-
Have you tried starting a line from the point you retrieve, I've found the same thing, but the point when used is where you expect it.
-
Actually I am finding the insertion point and writing it in an Excel File from where I am retrieving it later.
So while writing in Excel File, it truncates decimals.
-
The problem lies in the fact that your reference block is far away from origin 0,0,0... I suggest that you use (rtos) function with each point coordinate to get appropriate accuracy you need and then export to excel with higher precision values...
So something like this :
(setq f (open "c:/test.csv" "w"))
(write-line "X,Y,Z" f)
(write-line (strcat (rtos (car pt)) "," (rtos (cadr pt)) "," (rtos (caddr pt))) f)
(close f)
should be better if :
(write-line (strcat (rtos (car pt) 2 20) "," (rtos (cadr pt) 2 20) "," (rtos (caddr pt) 2 20)) f)
-
I'm using solution given by ribarm and it works fine for me.
-
Ribar, your solution works perfect.
What is the maximum limit of number of decimal places in RTOS function ?
-
16