CAD X、Y和高程标注插件

CAD X、Y和高程标注插件

4.CAD X、Y和高程标注插件,将其代码复制到记事本,保存后修改后缀名为lsp,拖入CAD中输入命令xyz即可标注X、Y和高程坐标。xyz.lsp下载(可能需手动改名为xyz.lsp)

(defun C:XYZ (/ OSNAP PNT1 P1X P1Y P1Z P STDX STDY STDZ XCOORD

YCOORD ZCOORD PTXT )

(setvar "ORTHOMODE" 0)

; (setq OSNAP (getvar "OSMODE"))

; (command "setvar" "osmode" "1")

(command "setvar" "luprec" "0")

(prompt "NOTE!!! Coords. & leader drawn per current dimstyle; precision per UNITS... ")

(setq dst (getvar "dimstyle"))

(command "_.-DIMSTYLE" "_Restore" dst)

(setq PNT1 (getpoint "\nPick coordinate point: "))

(setq P1X (car pnt1))

(setq P1Y (cadr pnt1))

(setq P1Z (caddr pnt1))

(setq P (getvar "LUPREC"))

(setq STDX (rtos P1X 2 P))

(setq STDY (rtos P1Y 2 P))

(setq STDZ (rtos P1Z 2 P))

(setq XCOORD (strcat "X " STDX ))

(setq YCOORD (strcat "Y " STDY ))

(setq ZCOORD (strcat "Z " STDZ ))

(setq PTXT (getpoint "\nPick text location: "))

(command "LEADER" PNT1 PTXT "" XCOORD YCOORD ZCOORD "")

; (command "SETVAR" "osmode" OSNAP)

(command "setvar" "luprec" "4")

(princ)

)