iLogic Create Leader Note no Attachment

iLogic Create Leader Note no Attachment

Anonymous
Not applicable
972 Views
2 Replies
Message 1 of 3

iLogic Create Leader Note no Attachment

Anonymous
Not applicable

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
0 Likes
Accepted solutions (1)
973 Views
2 Replies
Replies (2)
Message 2 of 3

AlexFielder
Advisor
Advisor
Accepted solution

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

 

🙂

0 Likes
Message 3 of 3

Anonymous
Not applicable

how do I modify from each sheet to only active sheet

0 Likes