Buffer around open polyline/line/arc?

Buffer around open polyline/line/arc?

Anonymous
Not applicable
5,940 Views
7 Replies
Message 1 of 8

Buffer around open polyline/line/arc?

Anonymous
Not applicable

Hi. I am wondering if there is a way (say, a lisp routine) to create a buffer around a line. Not an offset exactly, but a buffer. In GIS, there is a buffer command that, even if you use it on a straight line not a polygon just say a 1' line, it will draw a boundary around it of a certain distance. So if the buffer is around the 1' straight line, on each end there will be an arc that's the certain distance from the endpoints.

 

Post.jpg

 

For what I do, I can generally use the offset or change the line weight. That works if what I'm buffering is a closed shape, because there are no endpoints. However, if I have say a line or an arc that is not a closed shape, the offset/weight will work along the length but it doesn't get the end points right. I have to manually add them. For something simple like in the graphic it's not a big deal just to add the arcs, but when I get into more complicated and elaborate files that process can get tedious and time consuming.

 

I thought maybe somebody would have written a lisp routine or something for this but I haven't found it yet. And the posts I've found here so far seem to be regarding closed shapes and not dealing with the endpoint issue at all. 

 

I should also mention that this would be just for a visual reference. So a line weight could work as long as I could get the ends right. It doesn't have to be a separate shape.

 

Any help is appreciated. I'm using ACAD 04. 

 

Thanks.

 

0 Likes
Accepted solutions (1)
5,941 Views
7 Replies
Replies (7)
Message 2 of 8

Kent1Cooper
Consultant
Consultant

Sure looks familiar -- a Search for words such as in your Subject line uncovers [among other things] this [though it may return a lot to plow through to find it -- I was able to narrow it down to Posts of my own].

Kent Cooper, AIA
0 Likes
Message 3 of 8

Anonymous
Not applicable

Thanks Kent. I got the lisp routine loaded successfully but wasn't able to get any buffering done. I tried a few different widths on a line, polyline, circle and rectangle, and I always got the same error message:

 

Select object to add buffer around: ; error: no function definition:
VLAX-ENAME->VLA-OBJECT

 

I'm afraid that although I occasionally I run a lisp or two others have written I'm not adept at reading or writing code, so I'm not sure what I need to do to fix the error. I've attached the lisp file I pasted the routine into.

0 Likes
Message 4 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

.... I always got the same error message:

 

Select object to add buffer around: ; error: no function definition:
VLAX-ENAME->VLA-OBJECT

....


That's my fault.  I have something that loads (vl...) functions for me whenever I open AutoCAD, so I don't need to include something to do that in my routines, and I sometimes forget to, for those who don't get them automatically loaded, as you obviously don't.  Add this line [could go in various places, but put it just before the (defun C:...) line] into my code:

 

(vl-load-com)

Kent Cooper, AIA
Message 5 of 8

Anonymous
Not applicable

That rocks. Thanks so much. I wish I would have looked into this sooner, would have saved me a lot of time.

 

Should I add any copyright or other info to the file? I don't know that it will ever leave this office but just in case...

0 Likes
Message 6 of 8

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... Should I add any copyright or other info to the file? ....


Never mind that one.  Use the attached BUFFER.lsp [in which I did credit myself] -- it's seriously fleshed out and much more sophisticated, with enhancements mentioned in the source Post of the earlier one, and others.  It will put buffer boundaries around virtually anything you might ever want to add them around, and some thing you probably never will [such as Rays, just because it can] -- anything that OFFSET can be used on.  And it accounts for all sort of possible circumstances to avoid certain errors [see the comments at the top and within].  It does have its little limitations -- I may eventually work in different-UCS capability, but some of the possible-unexpected-results situations I don't think can be accounted for reliably, so they may have to remain requiring manual fixing.

Kent Cooper, AIA
Message 7 of 8

Anonymous
Not applicable

Hello again. So I'm giving the buffer lisp its first good workout today. It's working pretty well, but with several of my closed polylines I'm getting the message "Error: Automation Error. Description was not provided." Any idea what to do to fix it? Thanks again.

0 Likes
Message 8 of 8

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

... with several of my closed polylines I'm getting the message "Error: Automation Error. Description was not provided." Any idea what to do to fix it? ....


That's probably the result of conditions such as described in the "Can fail..." last paragraph of the comments at the top of the file [it mentions some specific possibilities that I'm aware of, but there may be others].

 

You could check by trying it on the same ones with the Outboard-only option [since most of the problems caused by those conditions are related to the inboard Offsetting result], or with a smaller buffer width, and see whether it works right.  When it fails like that, check whether a buffer boundary [most likely, but not necessarily, the inboard one] consists of more than one object, which results from some of those conditions.  I don't think that can be fixed in a way that could be counted on to work in every situation -- you may have to just do the Offsetting manually in such cases.

 

The routine can determine whether a Circle or Arc or Ellipse is too small for inward Offsetting at the requested buffer width, but it can't decide that by calculation for things that can have irregular shapes, like Polylines and Splines.  So if you ask for both-sides buffering, and the source is too small for the inward one to work at all, there won't be any object inside, which I think may result in the same error [I did get that message in some situations while developing it, though I don't recall whether specifically from that condition].  It's probably possible to catch that error and get around it, though I'd need to brush up on how to do it.

 

If it doesn't offer you the Outboard-only option, that probably means the Polyline isn't actually "closed" by AutoCAD's definition, but only looks closed by having its end at the same place as its beginning.  I haven't tried that situation, but I can imagine it could have trouble in trying to cap the open ends and join the results, depending on the particulars.  You could try changing them to Closed in the Properties box, and run the command again.

 

If you can't determine whether one of those situations is the cause, post a drawing with a few for which it fails, and tell us the buffer width(s) you asked for with them.

Kent Cooper, AIA
0 Likes