如果还有什么其他的,操纵elist和entmod折线是很有趣的:
- (defun C:test ( / SS d i )
- (and (princ "\nSelect polylines to chamfer: ")
- (setq SS (ssget "_:L" '((0 . "LWPOLYLINE"))))
- (setq d (getdist "\nSpecify chamfer distance: "))
- (repeat (setq i (sslength SS))
- (_ChamferPoly (ssname SS (setq i (1- i))) d)
- ); repeat
- ); and
- (princ)
- ); defun
- ; NOTE: it Straightens the bulges
- (defun _ChamferPoly ( e d / enx pts L nenx )
- (and
- (setq enx (entget e))
- (= "LWPOLYLINE" (cdr (assoc 0 enx)))
- (setq pts (apply 'append (mapcar '(lambda (x) (if (= 10 (car x)) (list (cdr x)))) enx)))
- (setq pts
- (apply 'append
- (mapcar '(lambda (x) (list (cons 10 x) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0)))
- (setq L
- (cond
- ( (= 1 (cdr (assoc 70 enx)))
- (apply 'append
- (mapcar '(lambda (a b) (list (polar a (angle a b) d) (polar b (angle b a) d)))
- pts (append (cdr pts) (list (car pts)))
- )
- )
- )
- (T
- (apply 'append
- (reverse
- (cdr
- (reverse
- (mapcar '(lambda (a b) (list (polar a (angle a b) d) (polar b (angle b a) d)))
- pts (append (cdr pts) (list (car pts)))
- )
- )
- )
- )
- )
- )
- ); cond
- )
- )
- )
- )
- (setq nenx (apply 'append (mapcar '(lambda (x) (if (not (member (car x) '(10 40 41 42 91 210))) (list x))) enx)))
- (entmod
- (setq nenx
- (append
- (subst (cons 90 (length L)) (assoc 90 nenx) nenx)
- pts
- (list (assoc 210 enx))
- )
- )
- )
- ); and
- ); defun _ChamferPoly
|