这是个赋值的小程序,本想让你自己去找,这样也好让你知道是谁做的,感谢人家,不过一时半会的我也不好再找到它的出处了。贴到这里吧 ,你自己再琢磨它的用法吧。从比例尺和等高距上考虑。
- (defun C:DGXF( / w s z g1 g2 tp1 tp2 ss1)
- (setvar "cmdecho" 0)
- (if (car (atoms-family 1 '("vl-load-com"))) (vl-load-com))
- (command "undo" "be")
- (setq w(getvar "userr1"))
- (if (= w 0)
- (progn
- (setq w(getreal "\n输入等高距: "))
- (setvar "userr1" w)
- (setq w(getvar "userr1"))
- )
- )
- (initget "g d")
- (setq qc_flags (getkword "\nG<往高处>/D<往低处>:<G>"))
- (if (eq qc_flags nil)
- (setq qc_flags "g")
- )
- (if (eq qc_flags "g")
- (princ)
- )
- (if (eq qc_flags "d")
- (setq w(- 0 w))
- )
- (setq th(entsel "\n选有值线:"))
- (if th (gele (car th)) (setq elev(getreal "\n没选到!请输入基线高程值: ")))
- (setq tp1 (getpoint "\n指定第一点:"))
- (setq tp2 (getpoint "\n指定第二点:"))
- (setq plist (list tp1 tp2))
- (setq S (ssget "F" plist ))
- (if s
- (progn
- (setq a 0)
- (repeat (sslength s)
- (setq z (setq ss1(ssname s a)))
- (setq g1(+ elev (* w a) w))
- (pele z g1)
- ;(setq g2(cons 38 g1))
- ;(entmod (subst g2 (assoc '38 z) z))
- (if (= (abs w) 2.5) (setq g3(rem (/ g1 w) 4)))
- (if (/= (abs w) 2.5) (setq g3(rem (/ g1 w) 5)))
- (if (= g3 0) (pcolor 1))
- (if (or (= g3 1) (= g3 -1))(pcolor 6))
- (if (or (= g3 2) (= g3 -2))(pcolor 6))
- (if (or (= g3 3) (= g3 -3))(pcolor 6))
- (if (or (= g3 4) (= g3 -4))(pcolor 6))
- (setq a (1+ a ))
- )
- (princ "\n ")
- (princ "最后一线值" )
- (princ g1)
- (princ)
- (command "undo" "e")
- )(princ "\n sorry 你没选到等高线!"))
- (setvar "cmdecho" 1)
- )
- ;;
- (defun gele(name-lsp)
- (setq vlaobject-name (vlax-ename->vla-object name-lsp))
- (setq elev (vla-get-Elevation vlaobject-name));;高程
- (vlax-release-object vlaobject-name)
- )
- (defun pele(name-lsp elev)
- (setq vlaobject-name (vlax-ename->vla-object name-lsp))
- (vla-put-Elevation vlaobject-name elev) ;;写入高程
- )
- (defun pcolor(n)
- (vla-put-Color vlaobject-name n)
- (vlax-release-object vlaobject-name)
- )
|