- 积分
- 2524
- 明经币
- 个
- 注册时间
- 2012-2-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2024-6-7 10:21:10
|
显示全部楼层
我的思路,定位提取高程文字,剔除错误点再展绘高程。;创建图层
(defun LL(str)
(command "layer" "m" str "")
)
;取组码中的文字
(defun V# (n e / pt_)
(if (not (listp e)) (setq e (entget e)))
(setq pt_ (cdr (assoc n e)))
(if (and (> n 9) (< n 34) (/= pt_ nil) ) (trans pt_ 0 1) (setq pt_ pt_) )
)
;写出CAD中Text内容到记事本,序号,X,Y ,文本内容
(defun c:ctextout(); 提取文本转换高度
(setq ffn (getfiled "写出文件" "" "txt" 1))
(setq zwd1 (getpoint "\n 请选择范围左下角点"))
(setq zwd2 (getcorner zwd1 "\n请选择范围对角点"))
(setq ss1 (ssget "_W" zwd1 zwd2 (list (cons 0 "TEXT"))) );text为X,y 高程点为 X,Y,Z
;(setq ss1 (ssget "X" (list (cons 0 "TEXT"))))全选文本
(setq n1 (sslength ss1) n0 0 str_e2 "")
(LL "DLG_TEXT")
(setq ff (open ffn "w"))
(repeat n1
(setq e1 (ssname ss1 n0) n0 (+ 1 n0) p1 (V# 10 e1) )
(setq str_e2 (v# 1 e1))
(setq txtz (strcat (rtos n0 2 0) "," "h" ","( rtos (nth 0 p1) 2 3 )"," ( rtos (nth 1 p1) 2 3 ) "," str_e2 ))
;高程点str_e2替换为( rtos (nth 2 p1) 2 3 )
(princ txtz ff)
(princ "\n" ff)
(print n0)
) ;end repeat
(close ff)
) |
|