多段线添加顶点- (defun C:tt (/ en dxfold dxf10 dxf90 pt ptlst dxfnew)
- (princ "\n 断面线添加顶点")
- (if (and (setq en (car (entsel "\n 选择设计断面线:")))
- (setq dxfold (entget EN))
- (= (cdr(assoc 0 dxfold)) "LWPOLYLINE")
- )
- (progn
- (setq dxf10 (vl-remove-if-not '(lambda (x) (= (car x) 10)) dxfold)
- dxf90 (1+ (cdr(assoc 90 dxfold)))
- dxfold (vl-remove-if '(lambda (x) (or (= (car x) 10) (= (car x) 40) (= (car x) 41) (= (car x) 42)))dxfold)
- dxfold (subst (cons 90 dxf90) (assoc 90 dxfold) dxfold)
- )
- (while (= (car (setq grpt (grread nil 5 0))) 5)
- (setq pt (cons 10 (cadr grpt))
- ptlst (cons pt dxf10)
- ptlst (vl-sort ptlst '(lambda(a b)(< (cadr a) (cadr b))))
- dxfnew (append dxfold ptlst)
- )
- (entmod dxfnew)
- );while
- );progn
- (alert "错误,所选不符合要求")
- );if
- )
演示:
|