Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
iwafb
Posts: 156
Registered: ‎05-17-2004
Message 1 of 3 (506 Views)
Accepted Solution

Delete objects in model and paper space

506 Views, 2 Replies
02-14-2013 05:37 PM

HI All,

 

Is there a quick way to simultaneously delete all objects in a layer if these objects are found across several layout tabs and model space?

 

At the moment, I'm getting the objects using:

 

(setq a (ssget "X" '((8 . "Revision"))))

 

This finds all objects in the drawing, but if I just use:

 

(command "_.erase" a "")

 

to delete them, only the the objects in the current layout or space are getting deleted...

 

Thanks in advance...

 

John.


iwafb wrote:

.... 

Is there a quick way to simultaneously delete all objects in a layer if these objects are found across several layout tabs and model space?

 

At the moment, I'm getting the objects using:

 

(setq a (ssget "X" '((8 . "Revision"))))

 

This finds all objects in the drawing, but if I just use:

 

(command "_.erase" a "")

 

to delete them, only the the objects in the current layout or space are getting deleted...

....


LAYDEL does that, and also purges the Layer out of the drawing.  [I'm not in a place right now where I can test whether that can be used in AutoLISP, but it's pretty simple to do manually.]
 

It's true of all object selections in (command) functions that they only "see" objects in the current space.  And stepping through that selection and using (entdel) on each item in it doesn't do what you're looking for, either, even though in many other ways objects in non-current spaces can be worked on with (ent...) and other functions.

*Expert Elite*
Kent1Cooper
Posts: 5,795
Registered: ‎09-13-2004
Message 2 of 3 (486 Views)

Re: Delete objects in model and paper space

02-14-2013 07:08 PM in reply to: iwafb

iwafb wrote:

.... 

Is there a quick way to simultaneously delete all objects in a layer if these objects are found across several layout tabs and model space?

 

At the moment, I'm getting the objects using:

 

(setq a (ssget "X" '((8 . "Revision"))))

 

This finds all objects in the drawing, but if I just use:

 

(command "_.erase" a "")

 

to delete them, only the the objects in the current layout or space are getting deleted...

....


LAYDEL does that, and also purges the Layer out of the drawing.  [I'm not in a place right now where I can test whether that can be used in AutoLISP, but it's pretty simple to do manually.]
 

It's true of all object selections in (command) functions that they only "see" objects in the current space.  And stepping through that selection and using (entdel) on each item in it doesn't do what you're looking for, either, even though in many other ways objects in non-current spaces can be worked on with (ent...) and other functions.

Kent Cooper
Distinguished Contributor
iwafb
Posts: 156
Registered: ‎05-17-2004
Message 3 of 3 (480 Views)

Re: Delete objects in model and paper space

02-14-2013 07:53 PM in reply to: Kent1Cooper

Thanks for your reply.

 

(command "_.laydel" "N" "Revision" "" "y")

 

Hadn't thought of that! I thought I was going to have to process the selection set and switch between layouts... In my case I didn't care if the layer was deleted, so it works a treat!

 

Cheers

John

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!