CAD LSP
望楼主帮忙看一下,加载后提示语法错误(defun c:gcdjc()
(setvar"cmdecho" 0)
(write-line "欢迎使用高程点自动检查与修改程序!")
(setq ent (ssget "x" '((8 . "gcd")(0 . "TEXT"))))
(if ent (progn
(command"zoom" "e")
(command"layer" "m" "gcd" "")
(setq ent-length (sslength ent))
(setq ent-num ber 0)
(repeat ent-length
(setq ent-name (ssname ent ent-num ber))
(c lgcd); 调入高程点检查与修改子程序
(setq ent-num ber (1+ ent-num ber))
)
(command"layer" "m" "0" "")
(command"zoom" "e")
(write-line "高程点检查修改完毕! ")
)
)
)
(defun c lgcd () ; 高程点检查与修改子程序
(setq data (entget ent-name))
(SETQ TEX (CDR (ASSOC 1 DATA))); 取得高程注记文本值
(setq p (cdr (assoc 10 data))) ; 取得高程注记文本位置坐标
(setq pl (polar p (* 1.25 pi) 7.0); 设置搜索范围
pr (polar p (* 0.25 pi) 10.0)
)
(setq ent-p (ssget "w" pl pr '((0 . "POINT") (8 . "gcd"))))
(if ent-p (progn ;注记周围有高程点
(SETQ p-length (sslength ent-p))
(setq p-num ber 0)
(setq p-data (entget (ssname ent-p p-num ber))); 取得高程点的数据表
(setq gcdz (rtos (cadddr (assoc 10 p-data)) 2 2))
(setq w c (- (a to f gcdz) (atof tex)))
(while (and (> = (abs wc) 0.01) (< p-number (1-p-length))) ; 对周围搜索到的高程点进行差值比较
(setq p-num ber (1+ p-num ber))
(setq p-data (entget (ssname ent-p p-number)))
(setq gcdz (rtos (cadddr (assoc 10 p-data)) 2 2))
(setq w c (- (atof gcdz) (atof tex))))
(if (> = (abs w c) 0.01)
(progn (command"zoom"pl pr)
(write-line "无匹配高程点, 请选择需要修改的高程点,不选择则自动加点. ")
(redraw ent-name 3) ;加亮显示待处理的高程注记
(setq p-se l (ssget)) ; 交互式获取需修改的高程点
(redraw ent-name 4) ; 取消加亮显示
(if p-se l
(progn
(setq se l (entget (ssname p-se l 0)))
(setq X (caddr (assoc 10 se l))
Y (caddr (assoc 10 se l))
)
(setq zb-new (list 10 X Y (atof tex)))
(setq se l (subst zb-new (assoc 10 se l) se l))
(entmod se l)
)
(jiagcd)
)
(command"zoom" "e")
)
)
)
(jiagcd) ;注记周围无高程点则自动加点
)
)
(defun jiagcd () ; 加高程点子程序
(setq p-xy (polar (polar p (* 0.5 pi) 0.5) pi 0.8))
(command"point" p-xy)
(command"change" "l" "" "p" "e" (atof tex) " ")
)
页:
[1]