如果有帮助,这是我用来抵消的lisp:
;Alfredo Rodriguez, 18 May 2014;This will offset an object multiple times;It will offset to the inside/outside, up/down, left/right depending on the drawing direction;So it's better to always set a maximum number of offsets or else it could offset indefinitely;For this reason, if use default is chosen, it will offset the object 20 times, or you can;choose how many times to offset. If object is offset to the wrong side, enter a negative distance (ej: -3 instead of 3);I'm not a lisp professional, so I can't guaranty any results obtained with this code, so use with care.(defun c:cntoffset (/ ename dist vobj obj objlist objlist2 how_many count maxcount thisdrawing size listname)(vl-load-com)(setq thisdrawing (vla-get-activedocument (vlax-get-acad-object))) ;This makes the Undo command erase only what's drawn in this lisp(vla-StartUndoMark thisdrawing) ;This makes the Undo command erase only what's drawn in this lisp (null (initget 7)) (while (setq ent (ssget)) (setq dist (getdist "\nEnter offset distance: ")) (setq how_many (sslength ent)) (setq count 0) (or (setq maxcount (getdist "\nEnter number of offsets (or press Enter to use default): ")) (setq maxcount 50) ) (while (/= count how_many) (setq ename (ssname ent count)) (setq obj (list (vlax-ename->vla-object ename))) (setq objlist (append obj objlist)) (setq count (+ count 1)) ) (setq count 0) (while (and (/= count maxcount) (/= objlist nil)) (setq count (+ count 1)) (setq vobj (car objlist)) (if (vlax-method-applicable-p vobj "Offset") ;(progn ;Activate this line during testing to see order in which objects are drawn (if (vl-catch-all-error-p (setq objlist2 (vl-catch-all-apply 'vlax-invoke (list vobj 'Offset (- dist))))) (progn (setq objlist2 nil) (prompt "\n*** Can not offset that object, try again. ***") (setq count 0) ) (setq size (length objlist2));To see if more than one object was created ) ;(prompt "\nDone") ;Activate this line during testing to see order in which objects are drawn ;(alert "\nJust for testing!!!") ;Activate this line during testing to see order in which objects are drawn ;Activate this line during testing to see order in which objects are drawn ) (if (> size 1);To create a different list name for each object, but this seens to be going nowhere (progn (setq count2 1) (while (< count2 size) (setq count2 (+ count2 1)) (setq listname (strcat "polylist" (itoa count2))) ) ) ) (setq objlist (append objlist2 (cdr objlist))) ) (setq objlist nil) (setq objlist2 nil) )(vla-EndUndoMark thisdrawing) ;This makes the Undo command erase only what's drawn in this lisp(princ))