Message 1 of 4
Attach prompted text to a line in a drawing with a leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to attach prompted text to a line in a drawing with a leader, i need help.
1) Click on the line
2) Call out the prompted text
3) Fill in the information
4) Finish (pic 1)
My code has an error on the last line.
Option Explicit
Sub Test()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oSketchedSymbolDef As SketchedSymbolDefinition
Set oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item("BALLOON")
Dim sPromptStrings(4) As String
sPromptStrings(0) = "aaaa"
sPromptStrings(1) = "bbbb"
sPromptStrings(2) = "cccc"
sPromptStrings(3) = "dddd"
sPromptStrings(4) = "eeee"
Dim oLine As Object
Set oLine = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Pick an edge:")
Dim oDrawingCurveSegment As DrawingCurveSegment
Set oDrawingCurveSegment = oLine
Dim oDrawingCurve As DrawingCurve
Set oDrawingCurve = oDrawingCurveSegment.Parent
Dim oMidPoint As Point2d
Set oMidPoint = oDrawingCurve.MidPoint
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.x, oMidPoint.y))
Dim oGeometryIntent As GeometryIntent
Set oGeometryIntent = oSheet.CreateGeometryIntent(oDrawingCurve)
Call oLeaderPoints.Add(oGeometryIntent)
Dim oSketchedSymbol As SketchedSymbol
Set oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchedSymbolDef, oLeaderPoints, 0, 1, sPromptStrings)
End Sub
Also, suppose my sketch symbol is placed in the NewFolder, is there a way to call it out? (picture 2)