读取纯数字的高程
(defun c:LT001()(setq drawm0 (getvar "userr1"))
(setq drawscl (/ drawm0 1000))
(setq ffn (getfiled "写出文件" "" "dat" 1))
(princ "\n请选择需要提取数据的数字:")
(setq ss (ssget))
(setq ff (open ffn "w"))
(setq i 0)
(setq n 1)
(repeat (sslength ss)
(setq ssn (ssname ss i))
(setq ssdata (entget ssn))
(setq txtg (cdr (assoc 40 ssdata)))
(setq wx (* drawscl 1.5))
(setq wy (* drawscl txtg 0.5))
(setq sstyp (cdr (assoc 0 ssdata)))
(if (or (= sstyp "TEXT") (= sstyp "MTEXT"))
(progn
(princ n ff)
(princ ",," ff)
(setq txtx1 (cadr (assoc 10 ssdata)))
(setq txtx (- txtx1 wx))
(princ txtx ff)
(princ "," ff)
(setq txty1 (caddr (assoc 10 ssdata)))
(setq txty (+ txty1 wy))
(princ txty ff)
(princ "," ff)
(setq txtz (cdr (assoc 1 ssdata)))
(princ txtz ff)
(princ "\n" ff)
)
)
(setq n (1+ n))
(setq i (1+ i))
)
(close ff)
(setq zds (1- n))
(princ (strcat "\n文件保存位置==>: " ffn))
(princ "\n本次总共提取了 ") (princ zds) (princ " 个高程点")
(prin1)
)
(princ "\n====蓝图测绘,精心制作; 键入 LT001 运行本插件;查看使用说明请键入 HH ====") 这是我学习LISP写的第一个代码,你怎么发这里来了,我都不要意思,太简单了
页:
[1]