;| WCSid.lsp Displays UCS and WCS coordinates of a specified point in current units, regardless of current UCS. It returns the WCS coordinates as a point list assigned to the global symbol Wpt. This routine mostly busies itself with getting the coordinates to line up nicely on the screen, as below: Command: WCSID Specify point: UCS point: X = 55'-3 7/8" Y = -30'-9 15/16" Z = 0" WCS point: X = 144'-3 3/4" Y = 71'-8 3/4" Z = 0" by Bill Gilliss bill at realerthanreal dot com Comments and suggestions always welcome. No warranty, either expressed or implied, is made as to the fitness of this information for any particular purpose. All materials are to be considered 'as-is', and use thereof should be considered as at your own risk.. ver 1.0 Jan 25 2010 - initial public release |; (defun c:wcsid ( / uPT uX uY uZ wX wY wZ lenX lenY spaceX spaceY formatLine) (defun formatLine (coord len / space temp) (setq space " ") (setq temp (strcat coord (repeat (1+ (- len (strlen coord))) (setq space (strcat space " ")) ) ) ) ) (setq uPT (getpoint "Specify point: ")) (setq wPT (trans uPT 1 0)) (setq uX (rtos (car uPT)) uY (rtos (cadr uPT)) uZ (rtos (caddr uPT)) wX (rtos (car wPT)) wY (rtos (cadr wPT)) wZ (rtos (caddr wPT)) ) (setq lenX (max (strlen uX)(strlen wX)) lenY (max (strlen uY)(strlen wY)) ) (princ (strcat "\nUCS point:" " X = " (formatLine uX lenX) " Y = " (formatLine uY lenY) " Z = " uZ) ) (princ (strcat "\nWCS point:" " X = " (formatLine wX lenX) " Y = " (formatLine wY lenY) " Z = " wZ) ) (princ "\n") wPT ) (princ "WCSid loaded.") (princ)