|
大家好,我从网上找到一个提取高程点坐标的LISP程序,但是提取出来点的顺序是随机的,不是我想要的顺序,求高手帮忙实现。
(defun c:gt()
(setvar "cmdecho" 0) ;指令执行过程不响应
(setq file (getfiled "文件保存为" "" "dat" 1))
(if (findfile file)
(setq ff (open file "a"))
(setq ff (open file "w"))
)
(setq n 0)
(while (setq ss (ssget '((0 . "insert") (2 . "gc200"))))
(repeat (setq k (sslength ss))
(setq en (ssname ss (setq k (1- k))))
(setq n(+ n 1))
(setq pn(rtos n 2 0))
(setq en_data (entget EN)) ;取得元体资料列表
(setq pt (cdr (assoc 10 en_data))) ;求得高程点坐标pt
(setq py(rtos (nth 1 pt)2 3));提取测量坐标Y值
(setq px(rtos (nth 0 pt)2 3));提取测量坐标X值
(setq pz(rtos (nth 2 pt)2 3));提取测量坐标Z值
(setq sxyz (strcat pn",,"px "," py "," pz))
(write-line sxyz ff)
)
)
(prompt "***** << C:gt >> ***提取高程点坐标输出为CASS格式****")
(close ff)
(prin1);
)
;从CASS中连续单选 高程点,并将高程点数据输出到文本,解决CASS不能有选择性的拾取高程点。
|
|