Originally Posted by
ros
Dear all,
Autocad 2004/2006 utility - lisp I used to pickup x, y coordinates
I have a lisp routine named: getloc1.lsp
This one writes: (Label) (East) (North) coordinates in a ASCII text file from
all the blocks placed into the drawing.
The only thing what I "miss" is that this lisp routine not writes
the coordinates in mm, it comes with precision meters.
We wants more precision, coordinates into mm
Example dutch topographical:
label east north
"-1.08" 105945.0 434017.0
We wants three decimals behind the comma (mm)
Note:
Autocad / command: units is set on three decimals
If I used the command list and select e block than I see the three decimals.
(X=105946.736 Y=434019.630 Z= 0.000)
I am not so familiar with AutoCAD lisp, have anyone a solution for this problem.
Thanks, regards, Theo van Rossum
So I take it that you're not civil because you would be asking for meters...
I have one which I used for both im and metric...
Your drawing should be setup for metric and the lisp works fine...
I have been using this lisp for years...
Here is a preset: ;;; "useri1" is used to check if Imperial (0) or Metric (2) standards.
If 0 the lisp goes to "ccyxi"
If 2 the lisp goes to "ccm"
Note the "DSCA 0.333" in ccm... which is just to set the text height...
Also it check to make sure the sheet is in whole...
Here is what you get when you select a point:
N 50.00
E 50.00
(Simple)
Anyway, I hope this helps...
Looking at it now I could re-write it better...
Code:
(defun c:CCxy ()
(if (= (getvar "useri1") 0) (ccxyi) (ccm)) )
(defun CCXYi ()
(setq dsca (getvar "dimscale"))
(setq vport (GETVAR "CVPORT"))
(setq us (getvar "luprec"))
(SETQ TXTSZ 2)
(IF (/= VPORT 1)(SETQ TXTSZ (/ DSCA 8)))
(prompt "\nPick Point for Coordinates ")
(command "setvar" "osmode" "35")
(setq jb (getpoint))
(setvar "orthomode" 1)
(command "setvar" "osmode" "0")
(setq xj (rtos (car jb) 2 us))
(setq yj (rtos (cadr jb) 2 us))
(setq xyjE (strcat "E " XJ))
(setq xyjN (strcat "N " YJ))
(setq xjyj (strcat xj "," yj))
(command "text" xjyj txtsz pause xyjn)
(setq fxy (entlast))
(setvar "orthomode" 0)
(command "text" "" xyje)
(command "MOVE" "l" fxy "" jb pause)
)
(defun CCM ()
(setq dsca (getvar "dimscale"))
(setq vport (GETVAR "CVPORT"))
(setq us (getvar "luprec"))
(SETQ TXTSZ 2)
(IF (/= VPORT 1)(SETQ TXTSZ (/ DSCA 0.333)))
(prompt "\nPick Point for Coordinates ")
(command "setvar" "osmode" "35")
(setq jb (getpoint))
(setvar "orthomode" 1)
(command "setvar" "osmode" "0")
(setq xj (rtos (car jb) 2 us))
(setq yj (rtos (cadr jb) 2 us))
(setq xyjE (strcat "E " XJ))
(setq xyjN (strcat "N " YJ))
(setq xjyj (strcat xj "," yj))
(command "text" xjyj txtsz pause xyjn)
(setq fxy (entlast))
(setvar "orthomode" 0)
(command "text" "" xyje)
(command "MOVE" "l" fxy "" jb pause)
)