Author Topic: vla-get-insertionpoint of BLOCK not giving decimal value  (Read 1899 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 493
vla-get-insertionpoint of BLOCK not giving decimal value
« 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 :-
« Last Edit: July 04, 2016, 07:04:38 AM by mailmaverick »

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: vla-get-insertionpoint of BLOCK not giving decimal value
« Reply #1 on: July 04, 2016, 09:34:00 AM »
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.


mailmaverick

  • Bull Frog
  • Posts: 493
Re: vla-get-insertionpoint of BLOCK not giving decimal value
« Reply #2 on: July 04, 2016, 09:37:52 AM »
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.



ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: vla-get-insertionpoint of BLOCK not giving decimal value
« Reply #3 on: July 04, 2016, 09:59:05 AM »
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)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ziele_o2k

  • Newt
  • Posts: 49
Re: vla-get-insertionpoint of BLOCK not giving decimal value
« Reply #4 on: July 04, 2016, 10:05:11 AM »
I'm using solution given by ribarm and it works fine for me.

mailmaverick

  • Bull Frog
  • Posts: 493
Re: vla-get-insertionpoint of BLOCK not giving decimal value
« Reply #5 on: July 04, 2016, 01:55:23 PM »
Ribar, your solution works perfect.

What is the maximum limit of number of decimal places in RTOS function ?

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: vla-get-insertionpoint of BLOCK not giving decimal value
« Reply #6 on: July 04, 2016, 02:11:58 PM »
16
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube