Saturday, June 6, 2009

How to get World coordinates from the ID command?

The ID command returns coordinates in the current UCS. If you want to get XYZ coordinates of the picked point always in the global, world UCS (WCS) - regardles of the active user coordinate system - you can use the following simple LISP macro.

Just save it to WID.LSP, load it with Appload and start the WID command (similar to ID):

;World ID
;3/2009 - www.xanadu.cz
(defun C:WID ( / pt)
(setq pt (getpoint "\nPick a point to ID in World UCS: "))
(if pt
(prompt (strcat "\nWorld X = " (rtos (car (trans pt 1 0)) 2)
" Y = " (rtos (cadr (trans pt 1 0)) 2)
" Z = " (rtos (caddr (trans pt 1 0)) 2)))
)
(princ)
)

No comments:

Post a Comment