cass或CAD里提取多段线节点的坐标的LSP程序谁有

2022-08-09 教育 146阅读
(defun c:gp()
(princ"函数功能:获取多义线点坐标. ")
(setvar "cmdecho" 0)
(setq ffn (getfiled "选取文件" "D:/zhb/" "dat" 1))
(setq ff (open ffn "w"))
(close ff)
(princ "\n选取PLINE多义线...")
(setq ss (ssget))
(setq i 0)
(setq ii 1) ;;输出点号
(setvar "pdmode" 33)
(repeat (sslength ss)
(setq ssn (ssname ss i))
(setq endata (entget ssn))
(setq n 0)
(repeat (length endata)
(setq pp (nth n endata))
(setq key (car pp))
(if (= key 10)
(progn
(setq x_temp (cadr pp))
(setq y_temp (caddr pp))
(setq x (rtos x_temp 2 3)) ;;把x后小数点变为四位输出
(setq y (rtos y_temp 2 3)) ;;把y后小数点变为四位输出
(setq iii (itoa ii))
(setq ff (open ffn "a"))
(princ iii ff)
(princ ",," ff)
(princ x ff)
(princ "," ff)
(princ y ff)
(princ "," ff)
(princ "0 "ff)
(princ "\n" ff)
(close ff)
(setq ii (1+ ii))
)
)
(setq n (1+ n))
)
(setq ii ii)
(setq i (1+ i))
)
(princ (strcat "\n文件写至=> " ffn))
(prin1)
)
(princ "\n====祝你工作顺利; 键入 gp 运行本插件")
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com