@fcolocho wrote:
... is possible to make the routine to offset those lines on both sides of the centerline? ....
If you mean on both sides to the same set of distances and to the same Layers, that's easier in a way, because it does not require the User to specify a side. The (vla-offset) function can just do it twice, once with a positive distance and once with a negative.
(defun C:MultiOffsetB (/ esel obj); = Multiple Offsets to Both sides
(if
(and
(setq esel (entsel "\nObject to Offset to both sides at mulitple distances & to multiple Layers: "))
(wcmatch (cdr (assoc 0 (entget (car esel)))) "LINE,*POLYLINE,ARC,CIRCLE,ELLIPSE,SPLINE,XLINE")
); and
(progn ; then
(command "_.layer" "_new" "LayerA,LayerB,LayerC" ""); ensure they exist
(setq obj (vlax-ename->vla-object (car esel)))
(foreach pair '((50 "LayerA") (150 "LayerB") (250 "LayerC"))
(vla-offset obj (car pair))
(command "_.chprop" "_last" "" "_layer" (cadr pair) "")
(vla-offset obj (- (car pair)))
(command "_.chprop" "_last" "" "_layer" (cadr pair) "")
); foreach
); progn
); if
(prin1)
)
I added the LAYER command to ensure the Layers exist -- it won't matter if they already do. Any that do not will get default properties like color 7 and continuous linetype; any that do will keep their properties. If they might not exist, that could be expanded to give them colors/linetypes/etc. as you prefer.
And I added an entity-type check. One curiosity is that for some reason the (vla-offset) approach does not work on RAYs, even though ordinary OFFSET does. So to include them would require an OFFSET-command-based approach, or some calculations for COPY, or something. It could be made a little more sophisticated to check that a Polyline is not 3D [those can't be Offset].
BY THE WAY, I notice some "smart quotes" in some of the earlier routines -- someone must have written them in a word-processor rather than in a plain-text editor. That could explain some of the problems noted.
Kent Cooper, AIA