附上源码: - (defun getmp(e / midp)
- (setq midp(vlax-curve-getPointAtParam e(/(-(vlax-curve-getEndParam e)
- (vlax-curve-getStartParam e)) 2))
- )
- )
- (defun maketxt(e / sp ep mp pam1 newe newmp txtp)
- (if (= 3.0 (vlax-curve-getEndParam e))
- (progn
- (setq sp(vlax-curve-getPointAtParam e 0)
- ep(vlax-curve-getPointAtParam e 3)
- mp(getmp e)
- pam1(vlax-curve-getPointAtParam e 1)
- pam2(vlax-curve-getPointAtParam e 2)
- ang(angle sp ep)
- )
- (entmake (list '(0 . "LINE") (cons 10 sp) (cons 11 ep)))
- (setq newe(entlast)
- newmp(getmp newe)
- DIS (DISTANCE sp pam1)
- )
- (entdel newe)
- (setq ep1(polar ep (angle ep pam2)(+ DIS 100)))
- (setq areadss(ssget "c" sp ep1 '((0 . "TEXT")(1 . "*[@]*"))))
- (if areadss (setq ang1(cdr(assoc 50 (entget(ssname areadss 0))))))
- (if (or (not areadss)(/= ang ang1))
- (PROGN
- (setq txtp(polar newmp (angle sp pam1)(+ DIS 50)))
- (entmake (list '(0 . "TEXT") (cons 1 "%%1328@200")(cons 8 "板底钢筋标注")
- (cons 10 '(0 0 0)) (cons 11 txtp)(cons 40 160)
- (cons 50 ang)(cons 62 1)(cons 72 1)(cons 73 1)
- )
- )
- )
- )
- )
- )
- )
- (defun c:xgj(/ ss n)
- (command "undo" "be")
- (setq ss(ssget '((0 . "LWPOLYLINE")(8 . "*钢筋"))))
- (if ss
- (repeat (setq n(sslength ss))
- (maketxt (ssname ss (setq n(1- n))))
- )
- )
- (command "undo" "e")
- (princ)
- )
-
|