ilogic sketched symbol with leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I trying to insert a symbol with a leader but i have a error message after de step 6, anybody can help me
with this code?
the code
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
' Set a reference to the drawing curve segment.
' This assumes that a drawing curve is selected.
Dim oDrawingCurveSegment As DrawingCurveSegment
oDrawingCurveSegment = oDrawDoc.SelectSet.Item(1)
' Set a reference to the drawing curve.
Dim oDrawingCurve As DrawingCurve
oDrawingCurve = oDrawingCurveSegment.Parent
' Get the mid point of the selected curve
' assuming that the selection curve is linear
Dim oMidPoint As Point2d
oMidPoint = oDrawingCurve.MidPoint
' Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
oLeaderPoints =
ThisApplication.TransientObjects.CreateObjectCollection
' Create a few leader points.
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X, oMidPoint.Y))
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X, oMidPoint.Y))
' Create an intent and add to the leader points collection.
' This is the geometry that the symbol will attach to.
Dim oGeometryIntent As GeometryIntent
oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve)
Call oLeaderPoints.Add(oGeometryIntent)
' Get the first symbol definition
Dim oSketchSymDef As SketchedSymbolDefinition
oSketchSymDef = oDrawDoc.SketchedSymbolDefinitions.Item("View_Label")
MessageBox.Show("6", "STEP")
' Create the symbol with a leader
Dim oSketchedSymbol As SketchedSymbol
oSketchedSymbol = oActiveSheet.SketchedSymbols.AddWithLeader(oSketchSymDef,oLeaderPoints)
the error message
Thanks for you help!