- (defun c:ts (/ p q pt en obj)
- ;(setvar'osmode 16384)
- (setq os_bak(getvar 'cmdecho))
- (setvar 'cmdecho 0)
- (setq p (getpoint "\n指定起点"))
- (while p
- (if p
- (progn
- (command "pline" "_non" p)
- (while (setq q (getpoint p "下一点")
- pt (mapcar '(lambda (x) (* x 0.5)) (mapcar '+ p q))
- )
- (command "_non" q)
- (setq en (entmakex
- (list '(0 . "DIMENSION")
- '(100 . "AcDbEntity")
- '(100 . "AcDbDimension")
- (cons 10
- (polar p
- (+ (* 0.5 pi) (if (and (< (/ Pi 2) (angle p q))
- (> (* 1.5 pi) (angle p q))
- )
- (angle q p)
- (angle p q)
- ))
- (* 6 (getvar "dimscale"))
- )
- )
- '(70 . 33)
- '(1 . "")
- '(100 . "AcDbAlignedDimension")
- (cons 13 (polar q
- (+ (* 0.5 pi) (if (and (< (/ Pi 2) (angle p q))
- (> (* 1.5 pi) (angle p q))
- )
- (angle q p)
- (angle p q)
- ))
- (* 3 (getvar "dimscale"))
- ))
- (cons 14 (polar p
- (+ (* 0.5 pi) (if (and (< (/ Pi 2) (angle p q))
- (> (* 1.5 pi) (angle p q))
- )
- (angle q p)
- (angle p q)
- ))
- (* 3 (getvar "dimscale"))
- ))
- )
- )
- obj(vlax-ename->vla-object en))
- (vla-put-ScaleFactor obj (getvar "dimscale"))
- (entmake (list '(0 . "TEXT")
- (cons 10 pt)
- (cons 40 1)
- (cons 1 (rtos (distance p q) 2 2))
- (cons 50
- (if (and (< (/ Pi 2) (angle p q))
- (> (* 1.5 pi) (angle p q))
- )
- (angle q p)
- (angle p q)
- )
- )
- ;(cons 7 "city")
- (cons 72 1)
- (cons 73 1)
- (cons 40 (* 2 (getvar "dimscale")))
- (cons 11 pt)
- )
- )
- (setq p q)
- )
- (if (>(getvar 'CMDACTIVE) 0) (command ""))
- (setq p (getpoint "\n指定起点"))
- )
- ;(setvar 'osmode (- (getvar osmode) 16384))
- )
- )
- (if (>(getvar 'CMDACTIVE) 0) (command ""))
- (if os_bak(setvar 'cmdecho os_bak))
- (princ)
- )
|