PDA

View Full Version : deleting objects inside or outside of a rectangle



Tyke
1st Sep 2010, 01:30 pm
My brains gone to bed but I'm still here.

Is there a way within AutoCAD to delete all objects within a rectangle (closed polygon) or all objects outside of the rectangle?

This then leads on to the question if you can trim to a rectangle or extend to it.

I believe I have seen it done somewhere, but it was a long time ago.

I know there are LISP routines out there that can do it, but just this once I want to do it the hard way ;-))

My problem is I have received a drawing from someone else, but I only need part of it. So before inserting it into my drawing I need to get rid of the stuff I don't need. It's easy enough to define the boundary of the area I need, a rectangle or polygon.

Anybody got an idea?

ReMark
1st Sep 2010, 01:37 pm
Re: trimming. Look at the EXTRIM command (Express Tools - command line only) or at Trims.zip at Cad Corner (Canada) that contains three different lisp routines that will trim/erase entities inside or outside of a user defined box. Link:

http://www.cadcorner.ca/lisp.php

You'll have to scroll down a ways to find it listed.

rkmcswain
1st Sep 2010, 01:39 pm
1. What about the standard selection method(s)? If you use the window selection method, everything contained inside the window will be selected. If you use the crossing selection method, everything inside and touching the window will be selected.

2. Yes, you can trim and extend to a rectangle polyline

3. If your selection area is not a rectangle or square, then you can use the "window polygon" or "crossing polygon" with the same effects as described above.

Dana W
1st Sep 2010, 01:47 pm
Short of a lisp routine, you will just have to zoom out and select the objects outside the rectangle with an include or crossing window, then erase. If you have pickadd and pickfirst set to <1>, you can use multiple select windows and/or clicks before erasing. Just don't zoom any of the selected objects off the screen until you erase. For some reason AutoCAD forgets what is selected if it goes off screen. If you select a large amount of objects at once, you may not see the grips highlight, if the count exceeds your grip display limit set on your tools > options > selection tab. Just have the selected objects set to highlight by dash or thicken or both so you will be able to tell what is selected.

Yes, you can extend and trim using a rectangle as a 'fence'.

(Did it really take me that long to type this? two posts? You guys are fast).

rkent
1st Sep 2010, 02:53 pm
Rather than select objects and worry about objects off the screen not being selected use, Erase, All, enter, Remove, crossing window inside rectangle, enter.

Tyke
1st Sep 2010, 02:59 pm
Hi guys, thanks for the "express" service.

ReMark: Thanks for the tip for Express Tools, I didn't realise there are command line only functions. Now that I've read the help text things are clearer.
The EXTRIM command does the trimming great.
I tried the LISP routine but it bombs out when I issue the command. I'm running a German language version of Civil 2011 on a HP Workstation with a German Windows XP Pro as OS. I don't know if there's something in there that's causing a problem, but I've looked at the LISP code and it seems clean enough. All the English commands are prefixed with an "_", so it should work, but it doesn't. I need a bit of time to look at that.

rkmcswain: I've tried using what you suggested, but that's not working 100% either. In a test situation I have a rectangle with various lines and polylines within, without and crossing the rectangle and some are trimmed others not.

Dana W: PICKADD and PICKFIRST are set to 1. The tip about zooming selected items off screen is a known problem here too, but thanks anyway as alot of people don't know about it.

Thanks guys your suggestions are most welcome and appreciated.

rkmcswain
1st Sep 2010, 05:00 pm
rkmcswain: I've tried using what you suggested, but that's not working 100% either. In a test situation I have a rectangle with various lines and polylines within, without and crossing the rectangle and some are trimmed others not.

Ok, my #1 was answering your second sentence only. (There was no mention of "trimming" objects there.)
Yea, I think EXTRIM should do what you want.

ReMark
1st Sep 2010, 05:05 pm
Das klingt wunderbar.

mdbdesign
1st Sep 2010, 05:30 pm
Try this codes:

Dana W
2nd Sep 2010, 12:51 am
Rather than select objects and worry about objects off the screen not being selected use, Erase, All, enter, Remove, crossing window inside rectangle, enter.

I make it a habit of never using 'erase' and 'all' on the same day, much less in the same sentence.:D

You can also trim and extend everything trimmable and extendable at/to the rectangle with crossing windows.

BIGAL
7th Sep 2010, 04:07 am
Forget the rectangle go the whole hog and just trim to any shape polyline including curves, you just use the trim command pick the polyline as a cutter but pick a second offest polyline as a "fence", you can bounce the offeset line further out if required or as I did change the objects inside the trim to a dummy layer then erase all objects not on the dummy layer change layer back again all done. Its the only bit of code I don't have was written for a specific client to trim waffle building construction pads. Like Dana above use the WP option to pick within polygon.

khoshravan
28th Jun 2011, 12:56 pm
For some reason AutoCAD forgets what is selected if it goes off screen.


Is it really true?
Isn't it fixed in newer versions of ACAD (2010)?

Dana W
28th Jun 2011, 02:40 pm
Is it really true?
Isn't it fixed in newer versions of ACAD (2010)?
I dunno. You got 2010, I don't. Anyway, I have not had that happen to me since the 2007 version.

nestly
28th Jun 2011, 03:06 pm
Is it really true?
Isn't it fixed in newer versions of ACAD (2010)?

That's not a bug. Imagine the carnage that would ensue if a selection window did include off screen objects that inadvertently got selected when the user zooms or pans to a different area of the drawing.