Author Topic: SOLVED:Looking for a Lisp to delete objects in a selection window on all layouts  (Read 991 times)

0 Members and 1 Guest are viewing this topic.

DDS-NCorette

  • Mosquito
  • Posts: 2
Hello Everyone,

We are looking for a lisp that will delete objects on every layout in a drawing. I have seen a lisp that will delete objects of the same type and layer on every layout, but unfortunately that doesn't give us enough descriptiveness to only delete the objects we need to delete. The location of the objects we want to delete will be the same on every layout, so ideally the lisp will be able to take a selection window on one layout, and delete all the objects within that window location on every layout. If it is easier for coding purposes, we could even draw a box with lines/polylines on one layout and use that to define the selection window for all the other layouts, and then just delete the box at the end from the one layout. If anyone has any ideas, or if any more information would be helpful, please let me know!

Thank you all,

- Noah
« Last Edit: August 10, 2021, 10:43:21 AM by DDS-NCorette »

DDS-NCorette

  • Mosquito
  • Posts: 2
Hey Guys,

Between searching through various forums, help from other users, and just messing around with Lisps, I have managed to put together a very simple lisp that accomplishes what I want to do:

Code: [Select]
; Deletes an object from the same selection window in all layouts
(defun c:DELayouts ()
(setq pt1 (getpoint "\pick 1st point for window "))
(setq pt2 (getpoint pt1 "\pick 2nd point for window "))
  (foreach layout (layoutlist)
    (setvar "ctab" layout)
    (command "pspace")
(command "erase" "w" pt1 pt2 "" )   
    );foreach
  (princ)
  );defun

It takes a little while for it to run, but it's way way better than manually opening each layout and deleting an object.

Thanks,

- Noah


JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Welcome to TheSwamp.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Nice routine! I like how simple is was created!
Civil3D 2020