Erase selected objects from all paperspace tabs?

Erase selected objects from all paperspace tabs?

johnw
Collaborator Collaborator
877 Views
1 Reply
Message 1 of 2

Erase selected objects from all paperspace tabs?

johnw
Collaborator
Collaborator

The following routine will copy a selected object to ALL paperspace tabs. Is there a way to change this code to erase the object picked on one sheet, on all other paperspace tabs?  Feel free to use this code if you don't have the "copy to tabs" routine...

 

(defun c:c2t (/ ss sslist doc tabs)
(if (and (= (getvar "cvport") 1)
(setq ss (ssget))
)
(progn
(while (> (sslength ss) 0)
(setq sslist (cons (vlax-ename->vla-object (ssname ss 0)) sslist))
(ssdel (ssname ss 0) ss)
)
(setq doc (vla-get-activedocument (vlax-get-acad-object))
tabs (vla-get-layouts doc))
(vlax-for tab tabs
(if (and (not (eq (setq name (vla-get-name tab)) "Model"))
(not (eq name (getvar "ctab")))
)
(vlax-invoke doc 'copyobjects sslist (vla-get-block tab) 'pairs)
)
)
)
)
(princ)
)

0 Likes
878 Views
1 Reply
Reply (1)
Message 2 of 2

hencoop
Advisor
Advisor

No, each object is a distinct object different from the one selected on the current layout.  The selection method (SSGET) will not allow you to select anything on other layouts.  If you could select them you would need to switch to their layout tab before AutoCAD will let you delete them.  If they were blocks you could select them all by name and then, from their entity data you could determine their layouts and switch to it and delete each one in turn.

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes