双偏移:
- (defun c:dOff ( / doc sel )
- (if
- (and
- (ssget "_:L" '((0 . "ARC,CIRCLE,ELLIPSE,*LINE")))
- (setq *of (cond ((getdist (strcat "\nSpecify Offset" (if *of (strcat " <" (rtos *of) ">: ") ": ")))) (*of)))
- )
- (progn
- (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
- (vlax-for obj (setq sel (vla-get-activeselectionset doc))
- (foreach off (list *of (- *of)) (vl-catch-all-apply 'vla-offset (list obj off)))
- )
- (vla-delete sel)
- (vla-endundomark doc)
- )
- )
- (princ)
- )
- (vl-load-com) (princ)
双偏移到当前层:
- (defun c:dOffc ( / doc lay sel )
- (if
- (and
- (ssget "_:L" '((0 . "ARC,CIRCLE,ELLIPSE,*LINE")))
- (setq *of (cond ((getdist (strcat "\nSpecify Offset" (if *of (strcat " <" (rtos *of) ">: ") ": ")))) (*of)))
- )
- (progn
- (setq lay (getvar 'CLAYER))
- (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
- (vlax-for obj (setq sel (vla-get-activeselectionset doc))
- (foreach off (list *of (- *of))
- (if (not (vl-catch-all-error-p (setq err (vl-catch-all-apply 'vlax-invoke (list obj 'offset off)))))
- (foreach obj err (vla-put-layer obj lay))
- )
- )
- )
- (vla-delete sel)
- (vla-endundomark doc)
- )
- )
- (princ)
- )
- (vl-load-com) (princ)
|