- 积分
- 1711
- 明经币
- 个
- 注册时间
- 2013-3-23
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2013-11-30 22:48:43
|
显示全部楼层
本帖最后由 蓝图测绘 于 2013-11-30 22:51 编辑
我也来一个,在"Gu_xl” 版主的基础上,加了一个用范围线选择高程点生成数据文件。
;有选择性的拾取高程点生成DAT文件
;有点选、框选、范围线3种选择方式
(defun c:g2d()
(setvar "cmdecho" 0)
(setq file (getfiled "文件保存为" "" "dat" 1))
(if (findfile file)
(setq ff (open file "a"))
(setq ff (open file "w"))
)
(setq xzfs (getint "\n高程点选择方式:[图上拾取( 1 )] / [选择范围线( 2 )]: < 1 >"))
(if (= xzfs nil) (setq xzfs 1))
(if (= xzfs 2)
(progn
(while (null (setq fwx (car (entsel "\n选择范围线(闭合多边形):")))))
(setq bh (cdr (assoc 70 (entget fwx))))
(if (or (= bh 0) (= bh 128))
(progn
(alert "你选择的范围线没有闭合")
(while (null (setq fwx (car (entsel "\n选择范围线(闭合多边形):")))))
(setq bh (cdr (assoc 70 (entget fwx))))
(if (or (= bh 0) (= bh 128)) (exit))
)
)
(setq fwxb (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget fwx))))
)
)
(cond
((= xzfs 1) (setq ss (ssget '((0 . "insert") (2 . "gc200")))))
((= xzfs 2) (setq ss (ssget "wp" fwxb '((0 . "INSERT") (2 . "GC200")))))
)
(setq i 0)
(repeat (sslength ss)
(setq en (ssname ss i))
(setq en_data (entget en))
(setq pt (cdr (assoc 10 en_data)))
(setq i (1+ i))
(setq str (strcat (rtos i 2 0) ",," (rtos (car pt) 2 3) "," (rtos (cadr pt) 2 3) "," (rtos (caddr pt) 2 3)))
(write-line str ff)
)
(close ff)
(princ (strcat "\n文件保存位置==>: " file))
(princ "\n本次总共提取了 ") (princ i) (princ " 个高程点")
(prin1)
)
(princ "\n蓝图测绘,精心制作; 键入 g2d 运行本插件") |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|