未考虑角度规则化
- (defun c:tt (/ ang en lst m n pt1 pt2 ptm ss)
- (setq ss (ssget '((0 . "lwpolyline"))))
- (repeat (setq n (sslength ss))
- (setq en (ssname ss (setq n (1- n)))
- lst nil)
- (repeat (setq m (fix (vlax-curve-getendparam en)))
- (setq lst
- (cons (- (vlax-curve-getdistatparam en m)
- (vlax-curve-getdistatparam
- en
- (setq m (1- m))))
- lst)))
- (setq m (vl-position (apply 'max lst) lst)
- pt1 (vlax-curve-getpointatparam en m)
- pt2 (vlax-curve-getpointatparam en (1+ m))
- ptm (mapcar '(lambda (x y) (* 0.5 (+ x y))) pt1 pt2)
- ang (angtos (angle pt1 pt2) 0 5))
- (vl-cmdf "dtext" "j" "c" "non" ptm 300 ang "DN150-100")))
|