Offset Both Sides and close

Offset Both Sides and close

Anonymous
Not applicable
13,562 Views
62 Replies
Message 1 of 63

Offset Both Sides and close

Anonymous
Not applicable

Is there a way to offset bothe sides of a line or polyline and close the offset line.  For example I would like to create a regtangle from offseting a line 3m.

0 Likes
Accepted solutions (4)
13,563 Views
62 Replies
Replies (62)
Message 2 of 63

natasha.l
Alumni
Alumni

Hello @Anonymous, 

 

Thanks for posting. 

 

The offset command does not work in this way. The best command to create a rectangle would be the Rectang command,  have you tried it or are you trying to accomplish something else? 

 

Please "Accept Solution" if a reply or replies have helped resolve the issue or answered your question, to help others in the community.

0 Likes
Message 3 of 63

pendean
Community Legend
Community Legend
0 Likes
Message 4 of 63

Kent1Cooper
Consultant
Consultant
Accepted solution

You can use PEDIT to turn the Line into a Polyline and give it width, and then use PLWtoOutline.lsp with its PLWO command, available >here<, to turn it into a Polyline outline.  If that approach works for you, the components of it could be turned into a single routine, and there are other ways it could be done.

Kent Cooper, AIA
0 Likes
Message 5 of 63

Kent1Cooper
Consultant
Consultant
Accepted solution

@Kent1Cooper wrote:

You can use PEDIT to turn the Line into a Polyline and give it width....


[... or if it's already  a Polyline, even of multiple segments, give it a Global Width either through PEDIT or in the Properties palette.]

Kent Cooper, AIA
0 Likes
Message 6 of 63

Julio_Soto
Advisor
Advisor

Only with a LISP.  Someone already posted Lee-Mac's double offset LISP.  You'd need to modify it to close it. 

0 Likes
Message 7 of 63

Anonymous
Not applicable

Hi @natasha.l thanks for your respond.  I'm looking for a way to create a closed lines by offseting from a line or polyline.

0 Likes
Message 8 of 63

Anonymous
Not applicable

Hi @pendean thanks for your respond.  This pretty close of what I'm after, unfortunately it doesn't close the lines.

0 Likes
Message 9 of 63

Anonymous
Not applicable

Hi @Kent1Cooper thank for provided the solution.  It works for me, but it's required more steps to do.  I like the simply solution Double Offset suggested by @pendean unfortunately it doesn't close the line.

0 Likes
Message 10 of 63

Anonymous
Not applicable

Hi @Julio_Soto thank for your respond, I like the solution, it's simple to use but it doesn't close the line and I'm not familiar with Lisp language, I don't know how to change the script.

0 Likes
Message 11 of 63

Anonymous
Not applicable

2020-04.png

0 Likes
Message 12 of 63

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

Hi @Kent1Cooper thank for provided the solution.  It works for me, but it's required more steps to do. ....


 

I'm working on a consolidation into one -- maybe in the next few days....

Kent Cooper, AIA
Message 13 of 63

Sea-Haven
Mentor
Mentor

I thought Lee had one that closed I did hundreds of plines in one go for road line marking the other software wanted closed plines not width. Its a while ago now.

 

Its not hard to do just offset get endpt1 startpt1 endpt2 startpt2 then join correct and pedit. Will try to find save doing it again.

0 Likes
Message 14 of 63

Sea-Haven
Mentor
Mentor
Accepted solution

This is the quick and dirty version does not check if its a pline. Really should be added also line and arc etc. Pretty sure other version did.

 

(defun c:quicktest ( / dist obj obj2 obj3 obj4 objent2 objent3 end1 end2 start1 start2 )
(setq dist (getreal "\Enter the offset value Enter to exit"))
(while (setq obj (vlax-ename->vla-object (car (entsel "\nPick object or Enter to exit"))))
(VLA-OFFSET obj dist)
(setq obj2ent (entlast))
(setq obj2 (vlax-ename->vla-object obj2ent))
(setq end1 (vlax-curve-getendpoint obj2))
(setq start1(vlax-curve-getstartpoint obj2))
(VLA-OFFSET obj (- 0.0 dist))
(setq obj3ent (entlast))
(setq obj3 (vlax-ename->vla-object obj3ent))
(setq end2 (vlax-curve-getendpoint obj3))
(setq start2(vlax-curve-getstartpoint obj3))

(command "line" end1 end2 "")
(setq obj4 (entlast))
(command "line" start1 start2 "")
(command "pedit" "L" "y" "J" obj2ent obj4 obj3ent "" "")
)
(princ)
)

 

Message 15 of 63

Kent1Cooper
Consultant
Consultant
Accepted solution

@Kent1Cooper wrote:

@Anonymous wrote:

Hi @Kent1Cooper thank for provided the solution.  It works for me, but it's required more steps to do. ....


I'm working on a consolidation into one -- maybe in the next few days....


 

Try the attached OffsetBothSidesClose.lsp with its OBSC command.  Lightly tested, but it seems to work, on all kinds of object types and in different Coordinate Systems, and it remembers your offset distance [separately from regular Offset's distance] to offer as default on subsequent use.  See comments at the top of [and some within] the file.

 

There are certain circumstances in which it will not work as you might want, for instance on a Spline or Polyline that is of such a configuration that Offsetting it results in more than one  new object.

 

Also, it allows selection of certain things that it doesn't process [full Ellipses because it needs to allow for partial ones, closed Splines/Polylines because it needs to allow for open-ended ones, 3DPolylines because it needs to allow for "heavy" 2D ones that are of the same entity type].  As currently written, it simply bypasses any of those in the selection, but it could be enhanced to report on how many it bypassed, or put them into a selection set, or leave them highlighted, or something.

Kent Cooper, AIA
0 Likes
Message 16 of 63

Anonymous
Not applicable

@Kent1Cooper thanks for doing this.  It works pretty well, there are only a couple tidy issues I found so far.

1. The Polyline doesn't keep the orignal poloyline, whereas Line does.

 1.png

 

 

2. The closed Lines don't use the orignal color and layer name.

 

Default color: Yellow, layer: Defpoints

 

Original line, layer: Image, color: Cyan

b.png
After used the OBSC command

1.png

0 Likes
Message 17 of 63

Anonymous
Not applicable

@Sea-Haven It does the main job what it supposes to do, it works very well for me, thanks for taking some time to respond and proving the script. 

c.png

0 Likes
Message 18 of 63

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

... there are only a couple tidy issues I found so far.

1. The Polyline doesn't keep the orignal poloyline, whereas Line does.

2. The closed Lines don't use the orignal color and layer name.

Default color: Yellow, layer: Defpoints....


DON'T USE the DEFPOINTS LAYER!  If Layer 0 is either off or frozen or both, objects on DEFPOINTS cannot be selected or Osnapped to.  That would have the result you describe -- the end-closing Lines cannot be selected for joining.  If that's the current Layer when doing the Polyline, I can only imagine that there's some distinction made in JOIN vs. PEDIT / Join that somehow allows them to be included.  [I used PEDIT / Join for Lines and Arcs because JOIN didn't work with them in an AutoLisp (command) function, even though it did manually.]  In any case, even using that Layer, try it with Layer 0 thawed and on, and it should work as expected.

 

You can Search for references to DEFPOINTS for many discussions about why you should not use it, this particular problem, etc., etc.  Its use for such things is an archaism from way back in the days when that was the only Layer that would not plot.  But it has been a   v e r y   l o n g   time now since you've been able to set any  Layer to not plot, so do that, and name it something relevant to what you're drawing on it.

Kent Cooper, AIA
0 Likes
Message 19 of 63

kibitotato
Advocate
Advocate

Hi, I think that a little change to this lsp would work for me. Is is possible to do Offset 1 side, close and make a hatch? It would be nice.

0 Likes
Message 20 of 63

Kent1Cooper
Consultant
Consultant

@kibitotato wrote:

Hi, I think that a little change to this lsp would work for me. Is is possible to do Offset 1 side, close and make a hatch? It would be nice.


Something very similar is >here<, which is for closed shapes like building footprints, but includes Hatching.  For open-ended things requiring closing the ends to make the Hatch outline, are there criteria for which side to Offset to?  Would you expect to pick the side in the process?

Kent Cooper, AIA
0 Likes