Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete notes on specified sheet only

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
557 Views, 1 Reply

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

Delete notes on specified sheet only

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 

 

1 REPLY 1
Message 2 of 2
clutsa
in reply to: Anonymous

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

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report