Delete all annotations from view

Delete all annotations from view

alexandru.spinu3KN9U
Contributor Contributor
1,600 Views
4 Replies
Message 1 of 5

Delete all annotations from view

alexandru.spinu3KN9U
Contributor
Contributor

Is there a straight way to delete all the annotations that belong to a view? 

Basically I want to copy a drawing view from drawing to another, but with no annotations at all, just the view.

I wouldn't mind to delete all the annotations from the entire drawing. I will just not save the original drawing.

Thanks

0 Likes
1,601 Views
4 Replies
Replies (4)
Message 2 of 5

HideoYamada
Advisor
Advisor

Hello,

 

Here is a sample code.

Sub test()
    Dim sheet As Sheet
    Set sheet = ThisApplication.ActiveDocument.ActiveSheet
    
    Dim i As Integer
i = sheet.DrawingNotes.Count While i > 0 sheet.DrawingNotes(i).Delete i = i - 1 Wend i = sheet.DrawingDimensions.Count While i > 0 sheet.DrawingDimensions(i).Delete i = i - 1 Wend End Sub

This code will delete all drawing notes (leader or simple text) and drawing dimensions in the active sheet.

You can modify this code to delete the objects associated with the view you copied and pasted.

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 3 of 5

Sergio.D.Suárez
Mentor
Mentor

Hi, This rule only removes all the notes from the active sheet of a drawing, then you could copy the view as you describe it and then close this document without saving.

 

Dim oDoc As DrawingDocument= ThisDoc.Document

For Each oGeneralNote As GeneralNote In oDoc.ActiveSheet.DrawingNotes.GeneralNotes
	oGeneralNote.Delete
Next    

For Each oLeaderNote As LeaderNote In oDoc.ActiveSheet.DrawingNotes.LeaderNotes
	oLeaderNote.Delete
Next    

For Each oSymbol As SketchedSymbol In oDoc.ActiveSheet.SketchedSymbols
	oSymbol.Delete
Next

 I hope this helps with your problem. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 4 of 5

alexandru.spinu3KN9U
Contributor
Contributor

Thanks for your suggestions.

I had to add a couple of more lines to delete other annotations objects.

For a reason the holes notes couldn't be delete from 

sheet.DrawingNotes(i).Delete

I had to add a dedicated iteration for HoleThreadNotes event thought these object are part of the DrawingNotes...

i = sheet.Centerlines.Count
    While i > 0
        sheet.Centerlines(i).Delete
        i = i - 1
    End While
	
	 i = sheet.Centermarks.Count
    While i > 0
        sheet.Centermarks(i).Delete
        i = i - 1
    End While
	
	 i = sheet.DrawingNotes.HoleThreadNotes.Count
    While i > 0
        sheet.DrawingNotes.HoleThreadNotes(i).Delete
        i = i - 1
    End While

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

Try this...

 

1. Window select the entire view

2. Hit 'Delete'

3. When asked to delete VIEW ## choose 'Cancel'

 

Annotations disappear, View remains : )