
- [FONT=courier new]
- ;;******************风管管径标注 Begin *********************************
- (defun c:cheng_fg_bz ( / p0 ln1 ln2 ln3 p21 p22 p31 p32 angr w h txt_h cheng_fg_h txt sc fg_lay yfg)
- (chengs_error)
- (chengs_getvar)
- (princ " 标注前请设置一种合适的字体!")
- (setq p0 T)
- (while p0
- (setvar "osmode" 695)
- (setq ln1 nil)
- (setq p0 (getpoint "\n 选择风管中心线: "))
- (if p0
- (progn
- (while (= nil ln1)
- (setq ln1 (chengs_ssgetPoint p0 '((8 . "*_mid"))))
- (if ln1 (setq ln1 (ssname ln1 0)));中线
- (if ln1 (setq ln2 (chengs_fg_getfg ln1 p0)) (setq ln1 nil))
- (if ln2 (setq ln3 (car ln2) ln2 (cadr ln2))) ;主风管线ln2 ln3
- (if (and ln2 ln3)
- (princ)
- (setq ln1 nil p0 (getpoint "\n 选择风管中心线: "))
- )
- );endwhile ln1
- (setq fg_lay (cdr (assoc 8 (entget ln2))))
- (command ".layer" "m" (strcat fg_lay "_txt") "") ;标注图层
- (setvar "osmode" 16567)
- (setq
- p21 (cdr (assoc 10 (entget ln2)))
- p31 (cdr (assoc 10 (entget ln3)))
- p22 (cdr (assoc 11 (entget ln2)))
- p32 (cdr (assoc 11 (entget ln3)))
- )
- (if (not p22) (setq p22 (cdr (chengs_assoc 10 ln2 2))))
- (if (not p32) (setq p32 (cdr (chengs_assoc 10 ln3 2))))
- (setq angr (angle p21 p22)
- angr (chengs_pi2r angr)
- )
- (while (>= angr 180.0) (setq angr (- angr 180)))
- (setq w (distance (chengs_getpoint_per p0 p21 p22) (chengs_getpoint_per p0 p31 p32))) ;ln3->ln2距离
- (if (not cheng_fg_h) (setq cheng_fg_h 250))
- (if (not txt_h )(setq txt_h 250))
- (if yfg
- (progn
- (initget "T F")
- (princ "\n T-修改字高<")(princ txt_h)(princ "> / F-方风管:")
- ) ;endthen
- (progn
- (initget "T Y")
- (princ "\n Y-圆风管 / T-修改字高<")(princ txt_h) (princ "> / 风管高度<")(princ cheng_fg_h)(princ ">:")
- ) ;endelse
- );endif
- (setq h (getint))
- (cond
- ((= h "T")
- (setq txt_h nil)
- (while (not (setq txt_h (getreal "\n 重新设置字高:" ) )))
- (if (null yfg)
- (progn
- (princ "\n 风管高度<")(princ cheng_fg_h)(princ ">: ")
- (setq h (getint))
- ) ;endthen
- );endif
- )
- ((= h "Y")
- (setq yfg T)
- )
- ((= h "F")
- (setq yfg nil)
- (princ "\n 风管高度<")(princ cheng_fg_h)(princ ">:")
- (setq h (getint))
- )
- );endcond
- (if yfg
- (setq txt (strcat "%%C" (rtos w 2 0)))
- (progn
- (if (or (<= h 0) (not h)) (setq h cheng_fg_h))
- (setq cheng_fg_h h)
- (setq txt (strcat (rtos w 2 0) "X" (itoa h)))
- ) ;endelse
- );endif
- (command ".text" "J" "M" p0 txt_h angr txt)
- (setq angr (cdr (assoc 50 (entget (entlast)))))
- (if (> angr (/ pi 2)) (chengs_change (entlast) 50 (+ angr pi)))
- )
- );endif p0
- );endwhile
- (chengs_setvar)
- (princ)
- );endfun cheng_fg_bz
- ;;******************风管管径标注 End *********************************
- [/FONT]
|