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: 

Add and delete general note on all sheets

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1543 Views, 2 Replies

Add and delete general note on all sheets

Hello.

I have the need to:

add an general note on all sheets, (ok)

save to PDF, (ok)

delete genera note added. (ERROR)

 

 

 

Dim DrawDoc As Inventor.DrawingDocument = inventorApp.ActiveDocument
Dim Evasione As Inventor.GeneralNote

For Each Sheet In DrawDoc.Sheets Sheet.Activate() Dim Geom As Inventor.TransientGeometry = inventorApp.TransientGeometry Evasione = Sheet.DrawingNotes.GeneralNotes.AddFitted(Geom.CreatePoint2d(Sheet.Width - 3.5, 4.5), TextBox6.Text & vbCrLf & TextBox7.Text) Evasione.Rotation = 0.785398 'radianti Evasione.LineSpacing = 0.6 Evasione.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter Evasione.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle DrawDoc.Update() Next

-------+PDF GENERATION CODE-------

For Each Sheet In DrawDoc.Sheets
Sheet.Activate()
Evasione.Delete()
Next
DrawDoc.Update()

HELP Please.

 

2 REPLIES 2
Message 2 of 3
MechMachineMan
in reply to: Anonymous

Something like this should work for you.

 

Sub Main()
	Call AddNote()
	Call PrintPDF()
	Call DeleteNote()
End Sub


Sub AddNote()
	Dim invApp As Inventor.Application
	invApp = ThisApplication
	
	Dim oDrawDoc As Document
	oDrawDoc = invApp.ActiveEditDocument
	
	Dim oTG As Inventor.TransientGeometry = invApp.TransientGeometry
	
	For Each oSheet In oDrawDoc.Sheets
	
		oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - 3.5, 4.5), "Text" & vbCrLf & "Other Text")
		
		With oNote
			.Rotation = 0.785398 'radianti
			.LineSpacing = 0.6
			.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter
			.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle
		End With
		oDrawDoc.Update()
	Next
 End Sub
 
 Sub PrintPdf()
 	MsgBox("Code for printing goes here instead!")
 End Sub
 
 Sub DeleteNote()
 	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
			If oGeneralNote.Rotation = 0.785398
				oGeneralNote.Delete
			End If
		Next
	Next
 End Sub

 

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 3
jerinc101
in reply to: MechMachineMan

Can you provide ilogic rule for update existing general notes or delete and make a new one in active sheet only?

Thank you.

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

Post to forums  

Autodesk Design & Make Report