Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
ArchD
Posts: 320
Registered: ‎07-30-2008
Message 1 of 10 (1,445 Views)

Delete everything within or outside of a boundary?

1445 Views, 9 Replies
03-09-2009 12:03 PM
Does anyone have a way to delete everything in or outside of a boundary? I was thinking something like an xclip for normal objects. Right now I use extrim, but that only trims whats touching the boundary line and I would like for it to get rid of everything inside or outside of the boundary. No wipeouts either, not what I'm looking for.

Thanks in advance everyone.
Archie Dodge

Civil 3D 2013
Windows 7 64-bit
Xeon E5-1620 v2 @ 3.70 GHz
Nvidia Quadro K4000
32.0 GB RAM
*Some Buddy
Message 2 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-09-2009 12:13 PM in reply to: ArchD

Hi,

 

Make a Selection with CP or WP after recovering the
boundary's coordinates (better use a polyline) and then erase the
Selection, in order to remove everything inside the boundary or
use
Select->All->Remove->Selection, in
order to delete everything outside the boundary.

 

HTH


--
Humans are born with a wide
horizon.
As time goes by, the horizon narrows and
narrows, until it
becomes a point of view.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone have a way to delete everything in or outside of a boundary? I was
thinking something like an xclip for normal objects. Right now I use extrim,
but that only trims whats touching the boundary line and I would like for it
to get rid of everything inside or outside of the boundary. No wipeouts
either, not what I'm looking for. Thanks in advance
everyone.
*andrew
Message 3 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-09-2009 12:53 PM in reply to: ArchD

(DEFUN C:ERASEOUT ()
(COMMAND "ZOOM"
"E")
(SETVAR "HIGHLIGHT" 0)
(PRINC "\nTHIS COMMAND ERASES EVERYTHING
OUTSIDE A WINDOW\n")
(PRINC "\nPICK FIRST THEN SECOND POINT OF
WINDOW")
(SETQ PT1 (GETPOINT))
(SETQ PT2 (GETCORNER PT1))
(SETQ OBJS
(SSGET "C" PT1 PT2))
(SETQ W1 (GETVAR "EXTMIN"))
(SETQ W2 (GETVAR
"EXTMAX"))
(COMMAND "ERASE" "C" W1 W2 "R" OBJS "")
(PRINC)
(SETVAR
"HIGHLIGHT" 1)

)

 

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone have a way to delete everything in or outside of a boundary? I was
thinking something like an xclip for normal objects. Right now I use extrim,
but that only trims whats touching the boundary line and I would like for it
to get rid of everything inside or outside of the boundary. No wipeouts
either, not what I'm looking for. Thanks in advance
everyone.
*Kent Cooper
Message 4 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-09-2009 02:24 PM in reply to: ArchD
Here's a simplified version of the same, using the "All" option in object selection:

(DEFUN C:ERASEOUT ()
(SETVAR "HIGHLIGHT" 0)
(PRINC "\nTHIS COMMAND ERASES EVERYTHING OUTSIDE A WINDOW\n")
(command "_.erase" "_all" "_remove" "_crossing" pause pause "")
(SETVAR "HIGHLIGHT" 1)
(PRINC)
)

That avoids the need to Zoom to the extents so it will "see" everything, because "All" doesn't care
whether things are visible in the current view, the way "Window" and "Crossing" do. And the
crossing-window option in Erase will supply its own prompts about selecting the corners. No
variables required.

--
Kent Cooper


"andrew" wrote...
(DEFUN C:ERASEOUT ()
(COMMAND "ZOOM" "E")
(SETVAR "HIGHLIGHT" 0)
(PRINC "\nTHIS COMMAND ERASES EVERYTHING OUTSIDE A WINDOW\n")
(PRINC "\nPICK FIRST THEN SECOND POINT OF WINDOW")
(SETQ PT1 (GETPOINT))
(SETQ PT2 (GETCORNER PT1))
(SETQ OBJS (SSGET "C" PT1 PT2))
(SETQ W1 (GETVAR "EXTMIN"))
(SETQ W2 (GETVAR "EXTMAX"))
(COMMAND "ERASE" "C" W1 W2 "R" OBJS "")
(PRINC)
(SETVAR "HIGHLIGHT" 1)
)
....
*Joe Burke
Message 5 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-10-2009 02:57 AM in reply to: ArchD
Try this called CookieCutter2. It's similar to extrim with the option you asked for,
delete all inside or outside. Read the header comments for more info.

Joe Burke
Active Member
rkumar
Posts: 9
Registered: ‎02-25-2009
Message 6 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-11-2009 12:44 AM in reply to: ArchD
Hi Joe

Its working fine, Thanks for your post.

with regards

P Rajkumar
*Joe Burke
Message 7 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-11-2009 04:29 AM in reply to: ArchD
You're welcome.
Mentor
ArchD
Posts: 320
Registered: ‎07-30-2008
Message 8 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-11-2009 07:14 AM in reply to: ArchD
I couldn't ask for more. The description in the header is nice too, thank you very much.
Archie Dodge

Civil 3D 2013
Windows 7 64-bit
Xeon E5-1620 v2 @ 3.70 GHz
Nvidia Quadro K4000
32.0 GB RAM
*Joe Burke
Message 9 of 10 (1,445 Views)

Re: Delete everything within or outside of a boundary?

03-12-2009 06:50 AM in reply to: ArchD
You're welcome.

I spent a lot of time on that routine.

Joe Burke
Valued Contributor
hamid.akbari
Posts: 87
Registered: ‎05-28-2013
Message 10 of 10 (489 Views)

Re: Delete everything within or outside of a boundary?

05-20-2014 08:03 AM in reply to: *Joe Burke

this lisp works just for one object.

if I want to select multiple object to erase other objects ,what should I do?

Thanks

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.