AutoLISP to offset closed polyline, hatch, and delete the second polyline [C3D]

AutoLISP to offset closed polyline, hatch, and delete the second polyline [C3D]

Anonymous
Not applicable
13,509 Views
106 Replies
Message 1 of 107

AutoLISP to offset closed polyline, hatch, and delete the second polyline [C3D]

Anonymous
Not applicable

Hi. In our firm, we often created partial hatches within buildings (represented by closed polylines). The process is as follows:
1. We select a closed polyline that was previously drawn and that represents the outline of a building.

2. We offset the polyline 2 units inside, creating a scaled version of the original polyline within the first. 

3. We hatch the area within the two polylines with a specific hatch pattern, scale, layer and color.

4. We delete the smaller, inside polyline, leaving the original building outline and the new hatch within.

I'm looking to automate this process in some way. I had some marginal success with the Action Recorder, but it wasn't consistent if the building outline was angled, and I had to always use the rightmost edge of the building. I'm sure AutoLISP can automate this sequence, but I'm a complete beginner.

Can anybody spoonfeed me a script that does what I'm looking for? Thanks a whole ton.

13,510 Views
106 Replies
Replies (106)
Message 101 of 107

saqib_tipa
Advocate
Advocate

@Kent1Cooper

 

Thank you so much for making it all 4 ways. So nice of you.

This is very useful for me and I know many other will find it useful. 

 

You already did so much and I thankful to you for that just in case when you find some spare time, is this possible to add a loop effect in this. Means it keeps in copy mode and auto picks new created polyline and ask for next value until we hit escape.

Not urgent, even you may ignore this please I have no problem and happy with codes you already provided.

 

Thank you again.

0 Likes
Message 102 of 107

saqib_tipa
Advocate
Advocate

@Kent1Cooper 

Hello Mr. Kent.

Please make this lisp to make 2 copies automatically at once because we need mostly two copies and hatch them. We could write required units in the lisp how much we need 1st copy and after 1st copy how much we need 2nd copy.

Please modify this Lisp like this. I'll be thankful to you.

Thank you.

0 Likes
Message 103 of 107

Kent1Cooper
Consultant
Consultant

Illustrate with a small sample drawing, please, clearly indicating what are the original and the two copies and the Hatch pattern(s).  For example:  Should the 2nd copy always be in the same direction from the 1st copy as the 1st copy is from the original, asking you only for the 2nd distance?  Or would you sometimes want it to be in a different direction?  Does "two copies and hatch them" mean one Hatch pattern filling both resulting areas, or a separate Hatch pattern in each area?  Should the Lines closing the ends be between the original and the 1st copy and then separately between the 1st copy and the 2nd copy, or one pair of end closing Lines between the original and the 2nd copy?  Or if the copies could be in opposite directions, only between the 1st copy and the 2nd copy?  Etc., etc.

Kent Cooper, AIA
Message 104 of 107

john.uhden
Mentor
Mentor

@Kent1Cooper ,

I was going to add to that but then I noticed you had covered everything with "etc., etc."  😉

Umm, I can't figure out why he needs a copy, and why he can't do them individually.

Or, do the offset(?)/hatch and then copy.

John F. Uhden

0 Likes
Message 105 of 107

saqib_tipa
Advocate
Advocate

@Kent1Cooper 

 

Thank you for the reply. I attached sample drawing and answered your questions in the drawing.

Hope this will help to understand my requirements.

 

Thank you in advance.

0 Likes
Message 106 of 107

Kent1Cooper
Consultant
Consultant

At long last....  It uses the pattern names and scales in the sample drawing, so others will want to EDIT those.  [Lightly tested.]

Kent Cooper, AIA
Message 107 of 107

saqib_tipa
Advocate
Advocate

 

@Kent1Cooper 

 

Thank you for the code. Yes, this is what is required. 

Working nicely.

 

Thank you so much for your time and kind help.

 

 

0 Likes