- (defun c:tt (/ ss ent lis)
- ;多段线每段线中心标注本段线长
- (setq ss (ssget ":P:E" '((0 . "LWPOLYLINE"))))
- (setq ent (ssname ss 0))
- (mapcar '(lambda (x)
- (entmake (list '(0 . "TEXT") '(72 . 1) '(73 . 2)
- (cons 1 (car x))
- (cons 10 (cadr x))
- (cons 11 (cadr x))
- (cons 40 2.5)
- (cons 50 (last x)))))
- (mapcar '(lambda (x)
- (list (rtos (distance (car x)
- (cadr x)) 2 2) (mapcar '* '(0.5 0.5)
- (mapcar '+ (car x)
- (cadr x)))
- (- (rem (+ (angle (car x)
- (cadr x))
- (* 0.25 pi)) pi)
- (* 0.25 pi))))
- (mapcar 'list (setq lis (mapcar 'cdr (vl-remove-if-not '(lambda (x)
- (= 10 (car x)))
- (entget ent)))) (append (cdr lis)
- (list (car lis))))))
- (princ)
- )
|