- 积分
- 63995
- 明经币
- 个
- 注册时间
- 2010-5-9
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2011-1-31 22:07:58
|
显示全部楼层
本帖最后由 自贡黄明儒 于 2011-3-11 10:58 编辑
很实用,谢谢了!!!
;;;;;;;;;;;;;;;本程序用于修改等高线高程
;;;NewElevation高程和NewGradeElevation高程增量为全局
;;;命令(hh-ggcZ)
(defun hh-ggcZ (/ A EN END GRADEELEVATION N OBJECT SS SS4 STARTELEVATION)
(vl-load-com)
(if NewElevation
(progn (setq startElevation
(getreal (strcat "\n起始高程<"
(rtos NewElevation 2 3)
">:"
)
)
)
(if (= startElevation nil)
(setq startElevation NewElevation)
)
)
(progn (initget 1)
(setq startElevation (getreal "\n起始高程? "))
)
)
(if NewGradeElevation
(progn (setq GradeElevation
(getreal (strcat "\n高程增量<"
(rtos NewGradeElevation 2 3)
">:"
)
)
)
(if (= GradeElevation nil)
(setq GradeElevation NewGradeElevation)
)
)
(progn (initget 1)
(setq GradeElevation (getreal "\n高程增量? "))
)
)
(Setq ss (lt:ssget '("\n选择多义线,多义线高程将依次被修改...."
((0 . "POLYLINE,LWPOLYLINE"))
)
)
)
(setq NewElevation startElevation
NewGradeElevation GradeElevation
)
(if ss
(progn
(setq ss4 (sslength ss))
(setq n 0)
(while (/= ss4 n)
(setq en (ssname ss n))
(setq object (vlax-ename->vla-object en))
(vla-put-Color object 2)
(setq end (entget en))
(setq a (cdr (assoc 0 end)))
(if (= a "LWPOLYLINE")
(entmod (subst (cons 38 NewElevation) (assoc 38 end) end))
)
(if (= a "POLYLINE")
(entmod
(subst (reverse
(cons NewElevation (cdr (reverse (assoc 10 end))))
)
(assoc 10 end)
end
)
)
)
(setq n (+ n 1))
(SETQ NewElevation (+ NewElevation GradeElevation))
)
)
(princ "\n未选中多义线,再见!")
)
)
;;;;;;;;;;;;;;;本程序用于修改等高线高程
|
|