How to attach sketched symbol leader to view in drawing using inventor API?

How to attach sketched symbol leader to view in drawing using inventor API?

umesh.mhaskar
Contributor Contributor
1,268 Views
2 Replies
Message 1 of 3

How to attach sketched symbol leader to view in drawing using inventor API?

umesh.mhaskar
Contributor
Contributor

Dear All,

                   Can any one help me about how to attach sketched symbol leader  to any entity or view in drawing document using inventor API.?

 

Regards,

Umesh Mhaskar

0 Likes
Accepted solutions (2)
1,269 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk
Accepted solution

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.

Message 3 of 3

umesh.mhaskar
Contributor
Contributor
Accepted solution

Done..

Thanks

0 Likes