Delete outside of multiple polylines in one instance, is this possible?

Delete outside of multiple polylines in one instance, is this possible?

Jonathan.Gray68UQW
Enthusiast Enthusiast
12,031 Views
47 Replies
Message 1 of 48

Delete outside of multiple polylines in one instance, is this possible?

Jonathan.Gray68UQW
Enthusiast
Enthusiast

Hello all, 
I am wondering is there a lisp routine or something that will allow me to select multiple closed polylines and then delete everything outside of these closed polylines in one command? 

 

Please see the screenshots below as well as the corresponding AutoCAD file for any generous help you guys could give me :).  

Also out of curiosity could the inverse of what is shown below be somehow made as well? Where that I select the same 3 closed boundaries and have autocad trim what inside of each of 3 all at the same time? 

0 Likes
12,032 Views
47 Replies
Replies (47)
Message 2 of 48

hak_vz
Advisor
Advisor

Try use command TRIM. Select cutting polylines and then select contoure you want to trim.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 48

Jonathan.Gray68UQW
Enthusiast
Enthusiast

Hey there!  I can't get trim to work for me in this instance 😞  or maybe I am doing something wrong.... any other thoughts?  

I think me wanting to get rid of all linework rather it is touching any of the 3 closed black polylines or not is what is adding to the complexity of my request. 

0 Likes
Message 4 of 48

hak_vz
Advisor
Advisor

You can use command TRIM or express tool EXTRIM.

Trim outside each cutting polyline, and than select and erase all elements outside.

It can be automatized but it can produce unwanted result.

 

When trimm, in your sample select all tri cutting polylines and then pek each polyline to cut outside this cutting areas. You can select more tan one polyline (let say 2-3) since more of them can crush acad. As you progress you can increase number of selected polylines to cut.

 

With extrim you can cut arround just one cutting edge.

 

It took me no more then 20 seconds to do it with your sample

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 5 of 48

Kent1Cooper
Consultant
Consultant

@hak_vz wrote:

....

With extrim you can cut arround just one cutting edge.

 

It took me no more then 20 seconds to do it with your sample


The problem with EXTRIM, since it allows only one cutting edge, is that if you use it with the upper-left bigger outline, things are cut away that also pass through the lower-left outline, but they want the parts of those within that to remain.  And vice versa.  [Doing it with the right-end outline doesn't seem to affect anything that passes through the others.]  You would need to Break or Trim pieces out of all those that pass through both, somewhere in between the two outlines, then do EXTRIM with each of those outlines.

 

TRIM with a few Fence selections could handle that issue, and fairly quickly, but would not  also eliminate things that don't cross any  outline, so there would still be things remaining that they'd need to ERASE.  That's also true of the results after EXTRIM.

 

I don't have a solution, but try a Search -- there could be something already.

Kent Cooper, AIA
0 Likes
Message 6 of 48

vladimir_michl
Advisor
Advisor

You might be able to modify the EXTRIM Lisp tool from Express tools. The "outside" trim will be easier, just watch for lines going through multiple "isles" (will need to be Break-ed first) and the remaining lines going through none of them (can be then deleted with "all minus isles").

 

Vladimir Michl, www.cadstudio.cz - www.cadforum.cz

 

0 Likes
Message 7 of 48

ParishSouthBdx
Collaborator
Collaborator

first thing that came to mind for what you are looking to accomplish was a clipping boundary wherein you could toggle to inboard or outboard graphics.

0 Likes
Message 8 of 48

hak_vz
Advisor
Advisor

I do similar work almost daily and command TRIM do the trick. Once you cut all elements that pass through the fence its easy to erase all the rest. For some elements break is needed.

Today I'm crushed after tough working day and not in a mood to write some code.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 9 of 48

Jonathan.Gray68UQW
Enthusiast
Enthusiast

You my friend have hit the nail on the head!

 

There is currently not an all-in-one tool out there to do what I want :(.  I searched around and only run into one post but it doesn't give me the desired results.  

 

Just wondering do you have any other suggestions?

0 Likes
Message 10 of 48

Jonathan.Gray68UQW
Enthusiast
Enthusiast

Hey there friend, the post by  Kent1Cooper   outlines my problem perfectly.  There is not currently an all-in-one tool that can complete my required task. If you happen to ever want to take the time to help with any sort of code this will be greatly apricated by me and I am sure others in the future would be grateful as well :).  

0 Likes
Message 11 of 48

Jonathan.Gray68UQW
Enthusiast
Enthusiast

Hey There, 

Yes sir exactly what you said is 100% true. However the problem is I am no where knew smart enough to modify the EXTRIM code. 

Would you have any further suggestions?  

0 Likes
Message 12 of 48

Jonathan.Gray68UQW
Enthusiast
Enthusiast

Hey there, what you said sounds 100% reasonable and would quickly get my final result however the problem is what you have said is so far beyond advice of what I am that I would never be able to do that :(.  

 

So I am wondering do you have any other suggestions?  

0 Likes
Message 13 of 48

hak_vz
Advisor
Advisor

@Jonathan.Gray68UQWJust use command TRIM. Select cutting edges, and then crossing polylines  as @Kent1Cooper  explained in detail. Erasing rest is easy. Just be patient with selections.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 14 of 48

Jonathan.Gray68UQW
Enthusiast
Enthusiast

Hey there friend!  You are 100% correct about the steps but the sad part is being asked to do this about 100 times for the next 5 days... 😞 😞  So I was looking for a lisp routine to help :). 

0 Likes
Message 15 of 48

hak_vz
Advisor
Advisor

Unfortunately there is no simple solution for your problem. I have had similar tasks many times and I know how you feel. Similar situations have forced me to learn Autolisp.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 16 of 48

Kent1Cooper
Consultant
Consultant

@vladimir_michl wrote:

You might be able to modify the EXTRIM Lisp tool from Express tools. ....


... but maybe not legally.  See the copyright notice at the top.  It references the License Agreement, and maybe that allows this kind of thing.  If so, it does use a regular Trim command, so maybe there's a way to have it allow selection of more than one boundary, and step through doing its thing around each of them while using all of them as Trim boundaries.  That would get around the problem of things that pass through more than one boundary.

 

But eliminating stuff that doesn't touch any  of the boundaries would be entirely additional to what EXTRIM is set up to do.

Kent Cooper, AIA
0 Likes
Message 17 of 48

cadffm
Consultant
Consultant

@Jonathan.Gray68UQW 

If the benefit would be big enough for you/your company,

it's easy to order such a tool from one who does it as job 😉

 

 I can only write for myself personally:

For me it's possible to write 95% of this program (based on extrim) in a quick&dirty way

in 10-15minutes,

after this it works, but not for all situations and not bullet proof.

For the last 5% (handling of objects which are intersect with multiple cutting polylines & erase the objects outside of cutting objects)

i need 80minutes, or 140minutes or more?

(I am not a programmer, but i have a good understanding for the basics and can help myself,

 but without the daily practice and without a standard function library, it take time)

 

2h, 3h or more hours are lot of time for a problem what is not mine,

i guess that's one reason why not getting a full perfectly solution until now,

for me it is the reason.

 

@Kent1Cooper 

If someone don't like to re-write there own Extrim and he want to use

the expresstools code, it isn't a problem.

Just using the subfunction ETRIM, nothing to copy, nothing to edit.

Sebastian

0 Likes
Message 18 of 48

Kent1Cooper
Consultant
Consultant

@cadffm wrote:

....

@Kent1Cooper 

If someone don't like to re-write there own Extrim and he want to use the expresstools code, it isn't a problem.

Just using the subfunction ETRIM, nothing to copy, nothing to edit.


But there would  be something to edit.  The Trim command that uses only one  Trim boundary object is inside  the (etrim) subfunction, which works with only one  object as its 'na' argument [for example, it applies (entget) to it, so it can't be a multiple-object selection set].  So at the very least (etrim) would need to be altered to take a selection of multiple objects as Trim boundaries.  The stepping through them and (etrim)-ing at each one could presumably be handled outside (etrim), but that by itself wouldn't do the job.

Kent Cooper, AIA
Message 19 of 48

cadffm
Consultant
Consultant

"The stepping through them and (etrim)-ing at each one could presumably be handled outside (etrim), but that by itself wouldn't do the job."

 

That's it.

You don't need to copy or edit the extrim lisp,  but using etrim is not the whole work.

you can write your own part for object selection and foreach- each object ETRIM.

Thats the point i pointed to.

 

 

 

 

Sebastian

0 Likes
Message 20 of 48

Kent1Cooper
Consultant
Consultant

@cadffm wrote:

....

you can write your own part for object selection and foreach- each object ETRIM.

....


You would still have the problem described in Message 5.  In their sample drawing, the (etrim) subfunction [unaltered] cannot use both  their upper left and lower left outlines as Trim boundaries in the same TRIM command.  So if (foreach) gets to (etrim)-ing using the upper left outline first, some things that will be cut away outside it have parts that pass inside the lower left outline, and should remain within that.  They won't remain there unless the TRIM command inside (etrim) can be edited to accept both outlines as Trim boundaries.

Kent Cooper, AIA
0 Likes