断面标注
本帖最后由 yjpzc 于 2011-4-15 14:36 编辑(defun c:dmbz()
(setvar "cmdecho" 0)
(setq osmode_bak(getvar "osmode"))
(setvar "osmode" 0)
(command "layer" "M" "dmbz" "C" "7" "" "LT" "CONTINUOUS" "" "")
(princ "比例尺:<1:")
(princ scale)
(princ ">")
(setq scale1 (getreal))
(if (not (null scale1)) (setq scale scale1))
(setq zh (/ (* 2.5 scale) 1000))
(setvar "luprec" 1)
(setq midxy(getpoint "\n请选择断面的中点:"))
(setq midx(nth 0 midxy))
(setq midy(nth 1 midxy))
(setq midgc(getreal "\n请选择断面的中点高程:"))
(setq pt1(getpoint "\n请选择标注断面的点:"))
(while (/= pt1 nil)
(setq bzx(nth 0 pt1))
(setq bzy(nth 1 pt1))
(setq s(strcat "偏距:" (rtos (abs(- midx bzx))2 3)))
(setq h(strcat "高程:" (rtos (+ midgc (- bzy midy)) 2 3)))
(setq pt2 (getpoint pt1 "输入引线"))
(setq ang (angle pt1 pt2))
(setq ang1 (* (/ ang pi) 180))
(xy2)
(if
(and (>= ang1 90) (<= ang1 270))
(xy1))
(command "pline" pt1 pt2 pt3 "")
(command "text" "j" "c" pt5 zh 0 s)
(command "text" "j" "c"pt6 zh 0 h)
(setq pt1 (getpoint "输入标注点 (右击取消)"))
)
(setvar "osmode" osmode_bak)
)
运行后出现 错误: no function definition: XY2 小小改了下 将就用:dizzy:
(defun c:dmbz()
(setvar "cmdecho" 0)
(setq osmode_bak(getvar "osmode"))
(setvar "osmode" 1)
(command "layer" "M" "dmbz" "C" "7" "" "LT" "CONTINUOUS" "" "")
(princ "标注比例尺:<1:")
(princ scale)
(princ ">")
(setq scale1 (getreal))
(if (not (null scale1)) (setq scale scale1))
(setq zh (/ (* 2.5 scale) 1000))
(setq hxbl (getint "\n请输入断面横向比例 1 :"))
(setq zxbl (getint "\n请输入断面纵向比例 1 :"))
(setvar "luprec" 1)
(setq midxy(getpoint "\n请选择断面的中点:"))
(setq midx(nth 0 midxy))
(setq midy(nth 1 midxy))
(setq midgc(getreal "\n请选择断面的中点高程:"))
(setq pt1(getpoint "\n请选择标注断面的点:"))
(while (/= pt1 nil)
(setq bzx(nth 0 pt1))
(setq bzy(nth 1 pt1))
(setq s(strcat "偏距:" (rtos (* (abs(- midx bzx)) (/ hxbl 1000.000)) 2 3)))
(setq h(strcat "高程:" (rtos (+ midgc(*(- bzy midy) (/ zxbl 1000.000) ) ) 2 3)))
(setq pt2 (getpoint pt1 "输入引线"))
(setq ang (angle pt1 pt2))
(setq ang1 (* (/ ang pi) 180))
(defun xy2( /)
(setq pt5 (polar pt2 (+ (* pi 0.5 ) ang1) zh) ) (setq pt6 (polar pt2 (+ (* pi 1.5 ) ang1) zh) )
(setq pt3 (polar pt2 0 (* 5 zh)) )
)
(defun xy1( /)
(setq pt5 (polar pt2 (+ (* pi 1.5 ) ang1) zh) ) (setq pt6 (polar pt2 (+ (* pi 0.5 ) ang1) zh) )
(setq pt3 (polar pt2 0 (* 5 zh)) )
)
(xy2)
(if
(and (>= ang1 90) (<= ang1 270))
(xy1))
(command "pline" pt1 pt2 pt3 "")
(setvar "osmode" 16384)
;(command "text" "j" "c" pt5 zh 0 s)
(entmake (list '(0 . "TEXT") (cons 1 s) (cons 10 pt5) (cons 40 zh)))
;(command "text" "j" "c"pt6 zh 0 h)
(entmake (list '(0 . "TEXT") (cons 1 h) (cons 10 pt6) (cons 40 zh)))
(setvar "osmode" osmode_bak)
(setq pt1 (getpoint "输入标注点 (右击取消)"))
)
)
8年前的,要改就改好些啦
页:
[1]