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 without selecting geometry

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
alasdair_crawford
120 Views, 2 Replies

iLogic create leader without selecting geometry

TLDR: Can leader text be created through iLogic and placed at user defined coordinates, rather than on an edge?

 

I am currently automating our drawing notes with a global form which can be filled in by the user with various typed entries and tick boxes. There is then a button which runs a rule that creates and positions a table of notes which are all numbered. This currently works well. Some of the notes are relating to stencilling or stamping, for example:

 

"12. STENCIL PART NO XXXX IN LOCATION SHOWN, BLACK, 50MM HIGH"

 

The user will then manually add leader text with "SEE NOTE 12" with the leader pointing to the desired location of stencilling on an appropriate drawing view.

 

I would like to automate/semi-automate insertion of the leader. Currently if an extra note is added, then the note number may change, but the leader will have to be updated manually. I would like to have the leader text automatically created so that it includes the note number which is created with the table of notes. Additionally I want them created automatically so people don't forget to add them.

 

The ideal process would be that when the table of notes is created, a note with a leader is also created and is either dumped onto the drawing in an obvious location for the user to manually move, or the user is prompted to select coordinates for it using a mouse click.

 

Currently everything I can find online for inserting leaders through iLogic is based on a line having been selected before the rule is run. Is there a way to insert one without selecting a line? Can they just be inserted at user defined coordinates?

 

Thanks

Alasdair

 

Labels (4)
2 REPLIES 2
Message 2 of 3

Hi @alasdair_crawford.  Drawing automation, especially where dimensions and other annotations that normally get 'attached' to geometry are involved, are not really my area of focus, but we do not really need to 'attach' a LeaderNote to anything, in order to be able to create it.  If we only specify one point within the input ObjectCollection, then there will not be any 'Leader' showing after it gets places, but if you specify 2 or more points, then it will include / show the leader, as long as there is enough room between the first and second (or last) point for it to include the leader on the sheet.  Below is an example code that simply creates a single LeaderNote.  It does not require anything to be 'selected' before or after it runs.  However, the point coordinates are just hardcoded locations on the sheet, in 'database units' (centimeters), instead of 'document units'.  The first point indicates where the text will be placed, then any other points after that will be used as nodes along the leader, or the point of the leader.  The last point is for where the point of the leader should be.

Sub Main
	Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Return
	Dim oASheet As Inventor.Sheet = oDDoc.ActiveSheet
	Dim oLNotes As LeaderNotes = oASheet.DrawingNotes.LeaderNotes
	Dim oTO As TransientObjects = ThisApplication.TransientObjects
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oObjColl As Inventor.ObjectCollection = oTO.CreateObjectCollection
	oObjColl.Add(oTG.CreatePoint2d(5, 5))
	oObjColl.Add(oTG.CreatePoint2d(6, 6))
	Dim sFText As String = "Testing 1, 2, 3"
	Dim oLNote As LeaderNote = oLNotes.Add(oObjColl, sFText)
End Sub

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Thanks @WCrihfield , that does exactly what I was wanting! Really appreciate your help.

Best regards

Alasdair

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report