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: 

iLogic Create Leader Note no Attachment

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

iLogic Create Leader Note no Attachment

I want to create multiple leader notes that aren't attached to anything. If the first note is at coordinates (12.25,17.25), then the leader attachment point can be around (12.75,16.75).  The following code creates the notes, but they are general notes with no leaders. How can I revise the code to add leaders?

 

SyntaxEditor Code Snippet

'The setup
Dim invApp As Inventor.Application
invApp = ThisApplication
Dim oDrawDoc As DrawingDocument
oDrawDoc = invApp.ActiveEditDocument
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
'Looks up existing placed assembly
'oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'sets model parameter frame as oFrame
'oFrame = Parameter(oModelDoc, "frame")
'creates fake parameter for example purposes
oFrame = "X"
For Each oSheet In oDrawDoc.Sheets
	Dim Xcoord = 12.25
	Dim Ycoord = 17.25
	Dim LS = 0.4
	Dim oTG As Inventor.TransientGeometry = invApp.TransientGeometry
	oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "Model " & oFrame)
	Ycoord = Ycoord - LS
	oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "Note 2")
	oDrawDoc.Update()
	With oNote
		.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter
		.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle
		.TextStyle.FontSize = 0.203
	End With
Next
2 REPLIES 2
Message 2 of 3
AlexFielder
in reply to: Anonymous

here you go:

'The setup
Dim invApp As Inventor.Application
invApp = ThisApplication
Dim oDrawDoc As DrawingDocument
oDrawDoc = invApp.ActiveEditDocument
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
'Looks up existing placed assembly
'oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'sets model parameter frame as oFrame
'oFrame = Parameter(oModelDoc, "frame")
'creates fake parameter for example purposes
oFrame = "X"
For Each oSheet As Sheet In oDrawDoc.Sheets
	Dim Xcoord = 12.25
	Dim Ycoord = 17.25
	Dim LS = 0.4
	Dim oTG As Inventor.TransientGeometry = invApp.TransientGeometry
	Dim leaderPoints As ObjectCollection = invApp.TransientObjects.CreateObjectCollection()
	leaderPoints.Add(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord))
	dim oNote as leadernote = oSheet.DrawingNotes.LeaderNotes.Add(leaderpoints, "Model " & oFrame)
	leaderPoints.Clear()
'	oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "Model " & oFrame)
	Ycoord = Ycoord - LS
	leaderPoints.Add(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord))
	oNote = oSheet.DrawingNotes.LeaderNotes.Add(leaderPoints, "Note 2")
'	oNote = oSheet.DrawingNotes.GeneralNotes.AddFitted(oTG.CreatePoint2d(oSheet.Width - Xcoord, Ycoord), "Note 2")
	oDrawDoc.Update()
'	With oNote
'		.HorizontalJustification = Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter
'		.VerticalJustification = Inventor.VerticalTextAlignmentEnum.kAlignTextMiddle
'		.TextStyle.FontSize = 0.203
'	End With
Next

you were nearly there; I have commented out the section that changed the formatting section as an example for you to edit accordingly because the textstyle property doesn't exist on leadernote. 

 

Here is a link to the documentation in case you haven't seen it:

 

http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-0E649500-E267-4965-A0FB-3847CDB6349B

 

🙂

Message 3 of 3
Anonymous
in reply to: AlexFielder

how do I modify from each sheet to only active sheet

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

Post to forums  

Autodesk Design & Make Report