I confess I didn't look closely into it, but it was just the first thing among many that was returned by a Search for only the word "buffer," and only within these Forums. Try that, and the same with maybe additional term(s), and if it doesn't turn anything up, try a web search [out there, include AutoCAD or the name of any overlay program you're using in the Search terms]. I would be very surprised if there isn't something available already.
Hello from France
I am using since about 7 years a beautiful french routine from Gilles (gile)
The routine CORRIDORVERYNEW (you can select N plines) draw corridors/buffers (rectangle in fact) aroud plines with option to have boxes & numbering boxes & box width & box lengths & box hatches & ...
This routine could have a nice small improvment : an option to draw a 180 degrees arc on the first box and the same at the end (or on the last box)
So when I need arcs, I have to draw them one by one and if I have many plines with buffers/boxes (after running CORRIDORVERYNEW), it's a long work !!
***** If somebody can update/improve the routine I will appreciate !?
Anyway THANKS to Gilles (gile) !!
Please play with this routine ! ... Please remind that I am not at all a Lisp/VLisp developper !?
AND let me know if the routine is OK on your US/English ACAD 201X ??
Patrice BRAUD
@vngrupe wrote:
....
do anybody have lisp code to draw buffer zone around pline?
Try this, which works [in very limited testing] on more object types than Polylines:
(defun C:BUFFER ()
(setq
ogt (getvar 'offsetgaptype)
pea (getvar 'peditaccept)
buffer (getdist "\nBuffer width: ")
esel (entsel "\nSelect object to add buffer around: ")
); setq
(if
(and
esel
(setq
ent (car esel)
edata (entget ent)
etype (cdr (assoc 0 edata))
); setq
(wcmatch etype "*LINE,ARC,CIRCLE,ELLIPSE")
(not (wcmatch (substr (cdr (assoc 100 (reverse edata))) 5 1) "3,M"))
; 3D Polylines and Mlines can't be Offset
); and
(progn ; then
(setvar 'offsetgaptype 1); rounded corners
(setvar 'peditaccept 1)
(setq obj (vlax-ename->vla-object ent))
(vla-offset obj buffer)
(setq e1 (entlast))
(vla-offset obj (- buffer))
(setq e2 (entlast))
(if (and (not (vlax-curve-isClosed ent)) (/= etype "XLINE"))
; open-ended object other than Xline -- wrap Arcs around ends
(progn ; then
(command
"_.arc" (vlax-curve-getStartPoint e1) "_e" (vlax-curve-getStartPoint e2)
"_direction" (angtos (+ (angle '(0 0 0) (vlax-curve-getFirstDeriv e1 (vlax-curve-getStartParam e1))) pi))
"_.arc" (vlax-curve-getEndPoint e1) "_e" (vlax-curve-getEndPoint e2)
"_direction" (angtos (angle '(0 0 0) (vlax-curve-getFirstDeriv e1 (vlax-curve-getEndParam e1))))
); command
(if (not (wcmatch etype "SPLINE,ELLIPSE"))
(command "_.pedit" e1 "_join" "_all" "" ""); connect them
); if
); progn [close ends]
); if
); progn [valid object]
); if
(setvar 'offsetgaptype ogt)
(setvar 'peditaccept pea)
(princ)
); defun
I find it can have unexpected results in certain circumstances, e.g. when the original object is a Spline or Polyline with too-tight curvatures or bends relative to the buffer width, especially at the ends, or [of course] an Arc whose radius is smaller than the buffer width. But under "expected" circumstances it seems to work.
It also should be enhanced in various ways, e.g. to remember the buffer width, add error handling and command-echo suppression, etc.
You're welcome -- that was quick! So quick that I should point out that I "fixed" a little something, so if you copied it out before I Edited it, do it again.
Hello Kent
Beautiful ! Thanks !!
My "ultimate" dream : to get your 180 degres arcs on the CORRIDORVERYNEW routine of Gilles (gile) ...
My "modest" dream : a new version of your routine able to run on many selected objects ...
Regards & Admiration, Bye, Patrice
Patrice BRAUD
@Kent1Cooper wrote:
....
It also should be enhanced in various ways, e.g. to remember the buffer width, add error handling and command-echo suppression, etc.
Here's a fleshed-out version with those enhancements, @braudpat's multiple-object request, plus many more, much further developed in response to this thread.