- 积分
- 4337
- 明经币
- 个
- 注册时间
- 2009-9-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|

楼主 |
发表于 2014-10-31 14:27:03
|
显示全部楼层
弄了个代码,提取的坐标位数较小时候可以,但是Y值在3636456.72这一类就不行了,请指点:
;;;错误处理,按<ESC>处理--程序静静取消。
;;;-----------------------------------
(defun *error* (s)
(if (/= s "函数已取消")
(princ (strcat "\n错误: " s))
)
(princ)
)
(defun c:zbtt ()
(setvar "osmode" 0)
(princ)
(setq dc_file (getfiled "选择点坐标文件" "" "txt" 1))
(setq ss1 (entsel "请选择地面高程:")
ss (car ss1)
LST1 (entget ss)
sz (cdr (assoc 1 lst1))
)
(setq xytxt (open dc_file "a"))
(setq xy_list '())
;;(prompt "\n.\n.\n.\n>>>>>>>>>>选择多段线:")
(setq xy_list (MJ:Massoc
10
(entget (car (entsel "\n.\n.\n.\n>>>>>>>>>>选择多段线:")))
)
k (length xy_list)
d k
h0 (nth 0 (tt xy_list))
gcha (- (atof sz) (cadr h0))
)
(write-line "点号,X坐标,Y坐标" xytxt)
(repeat k
(setq a (nth (- k dh) (tt xy_list)))
(setq pt_list (strcat (rtos (- k dh) 2 1)
","
(rtos (car a) 2 3)
","
(rtos (+ gcha (cadr a)) 2 3)
)
)
(write-line pt_list xytxt)
(setq dh (- dh 1))
)
(write-line "----------END----------" xytxt)
(close xytxt)
)
(defun tt (lst)
(vl-sort lst '(lambda (x y) (< (car x) (car y))))
)
;;46.1 [功能] 多段线各顶点(见99.3)
;;示例 (MJ:Massoc 10 (entget (car (entsel))))
;; Notes:特别适合多段线各顶点
(defun MJ:Massoc (key alist)
(apply
'append
(mapcar '(lambda (x)
(if (eq (car x) key)
(list (cdr x))
)
)
alist
)
)
)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|