分段标注多段线长度 (闲的瞎写仅能直线)
(defun c:tt (/ ent ptlst str pt ang)(setq ent (car (entsel "\n请选择需要标注边长的图元:")))
(setq ptlst
(mapcar
'cdr
(vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget ent))
)
)
(if (>=
(apply '+
(mapcar '(lambda (x y)
(- (* (car y) (cadr x)) (* (cadr y) (car x)))
)
ptlst
(append (cdr ptlst) (list (car ptlst)))
)
) 0
)
(setq ptlst (reverse ptlst))
)
(mapcar '(lambda (x y)
(setq str (rtos (distance x y) 2 2))
(setq pt (polar (mapcar '* '(0.5 0.5) (mapcar '+ x y)) (- (angle x y) (* 0.5 pi)) 5))
(setq ang (- (angle (mapcar '* '(0.5 0.5) (mapcar '+ x y)) pt) (* 0.5 pi)))
(entmake (list '(0 . "TEXT")
(cons 1 str)
(cons 10 pt)
(cons 11 pt)
(cons 50 ang)
(cons 72 1)
(cons 73 2)
(cons 40 10)
)
)
)
ptlst
(append (cdr ptlst) (list (car ptlst)))
)
(princ)
) 有嵌套递归,有循环,挺好的 分段标注多段线长度确实可用 能加个判断吗?文字角度270度的改90。180度改0 直线不能标注,能不能改一下
页:
[1]