(defun c:MOFF (/ ss tmp safe lst *moff)
(vl-load-com)
(or *moff (setq *moff 0.0))
(setq doc (vla-get-ActiveDocument
(vlax-get-acad-object)))
(if (setq ss (ssget '((0 . "ARC,CIRCLE,ELLIPSE,*LINE"))))
(princ)
(progn (alert "Objects not supported now exiting")(exit))
)
(initget 6)
(while (setq tmp (getdist (strcat "\nSpecify Offset <" (vl-princ-to-string *moff) "> : ")))
(setq *moff (+ *moff tmp))
(vla-StartUndoMark doc)
(setq lst '())
(foreach var (mapcar (function (lambda (x) (vla-offset x *moff)))
(mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
(cond ((<= 0 (vlax-safearray-get-u-bound
(setq safe (vlax-variant-value var)) 1))
(setq lst (cons (vlax-safearray->list safe) lst)))))
(foreach Obj (setq lst (apply 'append lst))
(if (vl-some
(function
(lambda (x)
(vlax-invoke obj 'IntersectWith x acExtendNone)))
(vl-remove Obj lst))
(vla-put-color Obj acred))
)
(vla-EndUndoMark doc)
)
(princ)
)
(c:moff)
.....
(setq d 0.0 e (entsel "\nSelect object to copy: "))
(while (progn (initget 6) (setq newD (getreal "\nEnter additional incremental distance: ")))
(setq d (+ d newD))
(command "_.COPY" (car e) "" "_non" (cadr e) "_non" (strcat "@" (rtos d) "<270"))
);while
.....
Something not quite right but when you press enter for last offset will draw then code needs a reshuffle to draw at each offset.
Please test.
Romero,CodeDing, thank you very much for the help provided.
Based on the example drawing you posted,
will all of your future situations be similar?In most cases I will use horizontal polylines; although sometimes I will use other objects
An always horizontal line?no, sometimes I use rectangles; this is why the code should behave like an offset and not like a copy
offsetting up or down?they will always be downward offsets in the case of horizontal polylines.
If this is the case, why make this harder than necessary, when we can use copy and just keep copying the object down?However, I found your code interesting for when I use it with horizontal polylines. Unfortunately I ran into some inconveniences.