Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Delete notes on specified sheet only

Anonymous

Delete notes on specified sheet only

Anonymous
Not applicable

I have the following code which works well, but I want to delete the notes on only sheet 2 rather than each sheet.

 

SyntaxEditor Code Snippet

Dim invApp As Inventor.Application
	invApp = ThisApplication
	Dim oDrawDoc As Document
	oDrawDoc = invApp.ActiveEditDocument
	For Each oSheet In oDrawDoc.Sheets
		For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes
			oGeneralNote.Delete
		Next
		For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes
			oLeaderNote.Delete
		Next
	Next 

 

0 Likes
Reply
Accepted solutions (1)
579 Views
1 Reply
Reply (1)

clutsa
Collaborator
Collaborator
Accepted solution

All you need to do is specify what sheet is oSheet instead of looping thru all the sheets.

Dim invApp As Inventor.Application
    invApp = ThisApplication
    Dim oDrawDoc As Document
    oDrawDoc = invApp.ActiveEditDocument
    oSheet = oDrawDoc.Sheets(2) ' changed this line
        For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes
            oGeneralNote.Delete
        Next
        For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes
            oLeaderNote.Delete
        Next
'removed the 'Next' because we aren't in a loop anymore
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State
0 Likes