Offset Both Sides and close

Offset Both Sides and close

Anonymous
Not applicable
13,635 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,636 Views
62 Replies
Replies (62)
Message 41 of 63

kibitotato
Advocate
Advocate
any news? This lisp would be extremely useful in my work...
0 Likes
Message 42 of 63

Kent1Cooper
Consultant
Consultant

I'm working on this....  Using (initcommandversion) before the Hatch command makes it honor the settings of HPASSOC and HPLAYER, but it also affects how object selection works.  The complication is that in some circumstances with open-ended objects, after Joining the source object, the Offset result and the close-the-end Lines, the resulting object can be [but is not always] the same entity name as one of the source objects, and therefore is only sometimes the Last object.  I'm trying to find the right combination of things to check for to have the Hatching always get the right object selection.

EDIT:  I think I figured out what to check for.  Try the attached OffsetCloseHatch.lsp and its OCH command.  It does not force any particular settings of HPLAYER & HPASSOC [it could be made to if desired], but honors whatever your current settings are.

Kent Cooper, AIA
Message 43 of 63

kibitotato
Advocate
Advocate
works perfecly!!! thanks!!!!
0 Likes
Message 44 of 63

yanndellamaggiora
Contributor
Contributor

same thing without the acures, is it possible?

0 Likes
Message 45 of 63

Kent1Cooper
Consultant
Consultant

@yanndellamaggiora wrote:

same thing without the acures, is it possible?


Same thing as what?  [Which of my many messages on this topic are you replying to?]

 

What does "acures" mean?  [None of my language guesses gave a good answer in an on-line translator.]  If that is the HATCH pattern, does the code at Message 15, before anyone asked about Hatching, do what you want?

Kent Cooper, AIA
0 Likes
Message 46 of 63

kibitotato
Advocate
Advocate

unexpected result into autocad 2024 spanish... don´t know why.

kibitotato_0-1715242162649.png

 

0 Likes
Message 47 of 63

Kent1Cooper
Consultant
Consultant

We can't diagnose that from an image.  Post a .DWG file in which this happens, with before and after.  And which of the several routines are you using?

Kent Cooper, AIA
0 Likes
Message 48 of 63

kibitotato
Advocate
Advocate

I think that sometimes fails the join and close operation. Don´t know why. Sometimes works sometimes not...

0 Likes
Message 49 of 63

Kent1Cooper
Consultant
Consultant

That drawing file doesn't really tell us much -- it needs to show the "before" conditions.  What did you start with?

 

In any case, making some assumptions about which part of those was the initial object, it seems some things are not Joining, but I have no idea why not.

Kent Cooper, AIA
0 Likes
Message 50 of 63

kibitotato
Advocate
Advocate

Is it possible to fail when having custom ucs ??

0 Likes
Message 51 of 63

Kent1Cooper
Consultant
Consultant

@kibitotato wrote:

Is it possible to fail when having custom ucs ??


Well, even though it's not the WCS, if I go into PLAN view in the UCS in your sample drawing, and if I assume what you started with, it works for me.

Kent Cooper, AIA
0 Likes
Message 52 of 63

kibitotato
Advocate
Advocate

So, Is it possible to fix it in order to works with custom UCS and custom view? This is a very helpful tool for every day...

0 Likes
Message 53 of 63

Kent1Cooper
Consultant
Consultant

@kibitotato wrote:

..., Is it possible to fix it in order to works with custom UCS and custom view? ....


I was going to try having it go to PLAN view for each object before Offsetting & Joining & Hatching.  But I just tried it with your attachments to Message 48, without making that adjustment yet, and it worked for me, even if I changed the UCS and the view direction.  It's hard to diagnose a problem if it doesn't happen.

 

But I was assuming the "before" conditions -- you still haven't posted what you're starting with that results in the incorrect Hatching in your sample drawing.  It may not clarify the problem, but let's start with that.

Kent Cooper, AIA
0 Likes
Message 54 of 63

kibitotato
Advocate
Advocate

Test 2 with start conditions.

Is it that what you need???

0 Likes
Message 55 of 63

Kent1Cooper
Consultant
Consultant

Yes.  Unfortunately, the command succeeds in it for me [Acad2020 here -- I can try with a later version elsewhere later].  That makes it pretty impossible to trouble-shoot.  Since the problem seems to be in the joining, it could be that the JOIN functionality has been altered in some more recent version, so that these lines

 

 

            (initcommandversion); [to accept initial multiple selection]
            (command "_.join" toJoin "")

 

 

might need to be done differently.

 

EDIT:  A remote possibility:

See these lines in the original:

 

      (mapcar 'setvar svn '(0 0 0 1 "ANSI31" 0.005 0.0))
        ;; turn off Osnap, command echo, blips, set PEDITACCEPT &
        ;; Hatch properties <-- EDIT pattern name, scale, rotation [last 3 above]

 

Your sample drawing indicates that you have edited that to use 0.5 as the HPSCALE setting, changed from the original 0.005 [which was a part of the original request].  Is it possible that in editing that, you accidentally changed or deleted something else that might affect the operation?

Further EDIT:

I just opened the version as posted at Message 48, and I see that HPSCALE setting has not been changed.  I think that must mean you changed the scale of the patterns in the sample drawing after using the command.  Losing the possibility of mis-editing leaves me at a loss for an explanation, but it seems to be JOIN-related, since your red boundaries where it goes wrong are not the single Polylines that they ought to be, and that they become when I try it.

Kent Cooper, AIA
0 Likes
Message 56 of 63

kibitotato
Advocate
Advocate

Don´t think so. Tried with the original .lsp and still doesn´t work.

I think that something happens with the join opperation but... who knows... acad 2024 here

0 Likes
Message 57 of 63

kibitotato
Advocate
Advocate

If it helps.

When I use join operation I have to select first one objet, press enter, and then select the rest of the objets.  I think that in older versions, I can select all the objets at one time... It helps?

 

EDIT

JOIN command prompts and options:

Select source object or multiple objects to join at once:
 
SELECTING multiple objects to join at once: DOESN´T WORK FOR ME
 
EDIT 2
Sometimes works... I think that i get the same proble using OCH and join opperation...
0 Likes
Message 58 of 63

Kent1Cooper
Consultant
Consultant

@kibitotato wrote:

....

SELECTING multiple objects to join at once: DOESN´T WORK FOR ME
EDIT 2
Sometimes works... I think that i get the same proble using OCH and join opperation...

I was wondering whether it might be a version difference, but at least in Help, the description and listed prompt and options for the JOIN command are identical in 2020 and 2024 [and 2025, for that matter].

 

I wonder whether a re-installation....

Kent Cooper, AIA
0 Likes
Message 59 of 63

kibitotato
Advocate
Advocate

restored the defaults into autocad... It works...

Sorry for bothering you... Thank you so much.

0 Likes
Message 60 of 63

latino_alireza
Explorer
Explorer

Hey guys, OffsetBothSidesClose.lsp works perfectly, I just had a question. Even though it asks to select multiple objects and I do so, it still applies offsetting at both sides and closes it perfectly but to only one object. how can I do this at the same time to all selected objects?

0 Likes