Jump to content
  • 0
NicoleD

Delete all annotations in selected viewports

Question

Is there a command to be able to delete all annotations from all viewports on a page, or from all viewports selected? I tend to duplicate sheet layers but then have to go back and delete dimensions and callouts from each viewport one by one. It would be very helpful and a time saver to be able to do it all at once.

Share this post


Link to post

10 answers to this question

Recommended Posts

  • 0

Hi Nicole, I think the best way is to manage classes visibility from the classes menu, or deleting a whole class…

Share this post


Link to post
  • 0

@NicoleD

I wrote a Python script that will delete all objects from the annotations group of selected VPs. This script will also only work on the active Layer (either sheet or design, though DLVPs do not have an annotation group).

The script is undoable in case you make a mistake, but it is always recommended to test this in a copy file.

The script is located in Palette-1.

DeleteAnnoObjs.vwx

  • Like 2

Share this post


Link to post
  • 0
1 hour ago, Marissa Farrell said:

@NicoleD

I wrote a Python script that will delete all objects from the annotations group of selected VPs. This script will also only work on the active Layer (either sheet or design).

The script is undoable in case you make a mistake, but it is always recommended to test this in a copy file.

The script is located in Palette-1.

DeleteAnnoObjs.vwx

 

This is really cool. I'd be curious to know how I could modify it to omit certain objects (delete everything except the drawing labels for example).

 

Kevin

 

Share this post


Link to post
  • 0

The following script will leave out Drawing Labels if they only have the default records added to them, which is how they are inserted by default. Extra logic would need to be added in order to check if multiple records are attached to the drawing labels.

 

#Created by MFarrell 12/05/18
#Modified to exclude Drawing Labels

#collect handles of selected VPs on active layer
def GetHandle(h):
	if vs.GetTypeN(h) == 122:
		if vs.GetParent(h) == vs.ActLayer():
			hVP.append(h)
			
hVP = []
vs.ForEachObject( GetHandle, '(Sel = True)' )

#Traverse into the annotations group of selected VPs and delete all objects aside from Default DLs
for VP in hVP:
	anno = vs.GetVPGroup(VP, 2)
	h = vs.FInGroup(anno)
	objs = [h]
	h = vs.NextObj(h)
	while h != vs.Handle(0):
		#recs = vs.NumRecords(h)
		if str(vs.GetName(vs.GetRecord(h, 1))) != 'Drawing Label':
			objs.append(h)
		h = vs.NextObj(h)
	for obj in objs:
		vs.DelObject(obj)

 

  • Like 1

Share this post


Link to post
  • 0
1 hour ago, Marissa Farrell said:

The following script will leave out Drawing Labels if they only have the default records added to them, which is how they are inserted by default. Extra logic would need to be added in order to check if multiple records are attached to the drawing labels.

 

Thanks Marissa!

 

Kevin

Share this post


Link to post
  • 0

Great script!

Dumb question: I didn't think DLVP's had annotations?

3 hours ago, Marissa Farrell said:

This script will also only work on the active Layer (either sheet or design).

Share this post


Link to post
  • 0

Not a dumb question! That's on me 🙂 Good point!

I was trying to say that the script verifies that the VP is on the active layer, and the identifier I use doesn't differentiate between the Design Layers and Sheet Layers.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×