Ataching leader note to sketched symbol in drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to attach a leader note to a sketched symbol, but I get errors when adding geometry intent (commenting out the line adding the intent will add the leader but it is not attached)
If I were just to add a leader manually to the sketchedsymbol and move around the symbol, this leader is attached as expected.
from this manual leader I inspected the properties on the leaderNode with the attachedEntity property and tried to copy the values when creating the geomtryIntent, but did not work.
I tried a bunch if different things but here is the simplest version I would think should of worked but I get an, "Expecting object to be local" error.
other times I would get a, "Method 'Add' of object 'LeaderNotes' failed"
I am just working in the vb editor right now on IV2023
I got some clues form topics such as below: where they talk about hidden leaders to attach to, but cant seem to find out how where to find these nodes to attach to:
Insert Drawing Sketched Symbol Behind DrawingView
Leader note/node from Sketched Symbol
In my sketchedSymbols defintion I moved the point where I am trying to attach to to 0,0 in its sketch space
any ideas greatly appreciated
Public Sub AddLeaderNotetestxx()
Dim trg As TransientGeometry
Set trg = ThisApplication.TransientGeometry
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.activeDocument
Dim sk As SketchedSymbol
Dim oActiveSheet As Sheet
Set oActiveSheet = oDrawDoc.ActiveSheet
Set sk = oActiveSheet.SketchedSymbols(1).leader.Parent
Dim oMidPoint As Point2d
Set oMidPoint = sk.Position
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
Dim oGeometryIntent As GeometryIntent
Call oLeaderPoints.Add(trg.CreatePoint2d(oMidPoint.x + 5, oMidPoint.Y + 5))
Call oLeaderPoints.Add(trg.CreatePoint2d(sk.Position.x, sk.Position.Y + 1.1))
Set oGeometryIntent = oActiveSheet.CreateGeometryIntent(sk.leader.Parent, trg.CreatePoint2d(sk.Position.x, sk.Position.Y + 1.1))
Call oLeaderPoints.Add(oGeometryIntent)
Dim sText As String
sText = "API Leader Note"
Dim oLeaderNote As LeaderNote
Set oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)
End Sub