- (defun c:tt (/ CNT D DIST E LEN N PTS)
- (setq e (car (entsel "\n选择多段线:")))
- (setq n (cdr (assoc 90 (entget e))))
- (setq len (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e)))
- (setq cnt (fix (1+ (/ n 10.))))
- (princ (strcat "\n总节点数<"
- (itoa n)
- ">,压缩节点数为<"
- (itoa cnt)
- ">:"
- )
- )
- (if (> cnt 1)
- (setq d (/ len (1- cnt)))
- )
- (setq pts (cons (vlax-curve-getStartPoint e) pts))
- (setq dist 0)
- (if (> cnt 1)
- (repeat (- cnt 2)
- (setq dist (+ dist d))
- (setq pts (cons (vlax-curve-getpointatdist e dist) pts))
- )
- )
- (if (not (vlax-curve-isClosed e))
- (setq pts (cons (vlax-curve-getEndPoint e) pts))
- )
- (command "_pline")
- (foreach p pts
- (command "_non" (trans p 0 1))
- )
- (if (vlax-curve-isClosed e)
- (command "_c")
- (command "")
- )
- (entmod (append (entget (entlast)) '((62 . 1))))
- (princ)
- )
|