Sketch and Leader Text on .idw

Sketch and Leader Text on .idw

CGVJM6DF
Enthusiast Enthusiast
420 Views
2 Replies
Message 1 of 3

Sketch and Leader Text on .idw

CGVJM6DF
Enthusiast
Enthusiast

Hi,

 

Can someone help me?

CGVJM6DF_0-1709713089285.png

 

I need to make a circle and leader text on a drawing sheet.

That's what I did, but it's not exactly what I need. It can be done somehow, connected.

If I try to move the circle, the arrow should follow. I can't make the arrow just by points...

 

 

Dim oDoc As DrawingDocument
Dim oSht As Sheet
Dim oSketch As DrawingSketch
Dim oCircle As SketchCircle

oDoc = ThisApplication.ActiveDocument
oSht = oDoc.ActiveSheet
oSketch = oSht.Sketches.Add
oSketch.Edit

Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry

oCircle = oSketch.SketchCircles.AddByCenterRadius(oTG.CreatePoint2d(5, 10), 2)

oSketch.ExitEdit

Dim drw As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = drw.ActiveSheet

Dim leaderPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(6.4, 11.4)
Dim textPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(8, 14)

Dim leaderPoints As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
leaderPoints.Add(textPoint)
leaderPoints.Add(leaderPoint)

sheet.DrawingNotes.LeaderNotes.Add(leaderPoints, "Grinding Direction")

 

0 Likes
Accepted solutions (1)
421 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @CGVJM6DF.  It looks like you forgot to include a GeometryIntent as one of the leader points in the collection.  That is what 'attaches' the LeaderNode to a 'real' piece of geometry on the drawing sheet.  Below is an example iLogic rule similar to the one you posted that I typed up, and it seems to be working OK.  I can move the circle afterwards and the LeaderNote moves with it.

Sub Main
	Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Return
	Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
	Dim oSheetSketches As DrawingSketches = oSheet.Sketches
	Dim oSheetSketch As DrawingSketch = oSheetSketches.Add
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	oSheetSketch.Edit
	Dim oSkCircles As SketchCircles = oSheetSketch.SketchCircles
	Dim oCPoint As Inventor.Point2d = oTG.CreatePoint2d(5, 10)
	Dim oSkCircle As SketchCircle = oSkCircles.AddByCenterRadius(oCPoint, 2)
	oSheetSketch.ExitEdit
	Dim oGI As GeometryIntent = oSheet.CreateGeometryIntent(oSkCircle, PointIntentEnum.kCircularTopPointIntent)
	Dim oLeaderTextPoint As Inventor.Point2d = oTG.CreatePoint2d(8, 13)
	Dim oOColl As Inventor.ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	oOColl.Add(oLeaderTextPoint)
	oOColl.Add(oGI)
	Dim oLNotes As LeaderNotes = oSheet.DrawingNotes.LeaderNotes
	Dim oLNote As LeaderNote = oLNotes.Add(oOColl, "Grinding Direction")
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)

0 Likes
Message 3 of 3

CGVJM6DF
Enthusiast
Enthusiast

Thanks a lot @WCrihfield 

0 Likes