i'm totaly beginner with inv VBA. I don't know if there is something wrong on page or should i change something but original code not working. i made these modification:
Sub AddLeaderNoteWithHoleCenter()
' assumes you have had Inventor application
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oActiveSheet As Sheet
Set oActiveSheet = oDrawDoc.ActiveSheet
' get curve, assume a hole curve is selected
Dim oDrawingCurveSegment As DrawingCurveSegment
Set oDrawingCurveSegment = oDrawDoc.SelectSet(1)
Dim oDrawingCurve As DrawingCurve
Set oDrawingCurve = oDrawingCurveSegment.Parent
' get center point
Dim oMidPoint As Point2d
Set oMidPoint = oDrawingCurve.CenterPoint
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 5, oMidPoint.Y + 5))
' Create geometry intent from center point
Dim oGeometryIntent As GeometryIntent
Set oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve, oMidPoint)
Call oLeaderPoints.Add(oGeometryIntent)
Dim sText As String
sText = "Leader Note for one hole center"
' add leader note
Dim oLeaderNote As LeaderNote
Set oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)
End Sub
now works fine
there is a lot of information in this code.
will see if i will be able to revise to fint into my needs
Last question. I can get XYZ coords of model but is it possible to create link ("inteligent leader") between model and paper leader so when model change then leader update ? or i can only use this to describe corner but without link ?
thank you very mych Xiaodong. this is a really big help.
regards
romek