Hi Umesh,
Below is a VBA code sample to insert sketched symbol with leader, for your reference:
Public Sub InsertSketchedSymboSample()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
' Obtain a sketched symbol definition.
Dim oSketchedSymbolDef As SketchedSymbolDefinition
Set oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item(1)
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oDrawView As DrawingView
Set oDrawView = oSheet.DrawingViews(1)
Dim oCurve As DrawingCurve
Set oCurve = oDrawView.DrawingCurves.Item(1)
Dim oGeoIntent As GeometryIntent
' Get the attached geometry for the sketched symbol leader
If oCurve.CurveType = kCircleCurve Or oCurve.CurveType = kEllipseFullCurve Then
Set oGeoIntent = oSheet.CreateGeometryIntent(oCurve, kCenterPointIntent)
Else
Set oGeoIntent = oSheet.CreateGeometryIntent(oCurve, kStartPointIntent)
End If
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
oLeaderPoints.Add oTG.CreatePoint2d(15, 15)
oLeaderPoints.Add oTG.CreatePoint2d(20, 16)
oLeaderPoints.Add oGeoIntent
' Create sketched symbol
Dim oSketchedSymbol As SketchedSymbol
Set oSketchedSymbol = oSheet.SketchedSymbols.AddWithLeader(oSketchedSymbolDef, oLeaderPoints, (3.14159 / 4))
End Sub
If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.
Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.