cass或CAD里提取多段线节点的坐标的LSP程序谁有
1个回答
展开全部
(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 运行本插件")
(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 运行本插件")
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询