Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear All,
Anyone help me to add multiple leader to ballon using inventor api.
Regards,
Umesh Mhaskar
Solved! Go to Solution.
Dear All,
Anyone help me to add multiple leader to ballon using inventor api.
Regards,
Umesh Mhaskar
Solved! Go to Solution.
Dim ThisApplication as inventor.Application
ThisApplication=GetObject(", Inventor.Application")
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 drwaing curve is selected.
Dim oDrawingCurveSegment1 As DrawingCurveSegment
oDrawingCurveSegment1 = oDrawDoc.SelectSet.Item(1)
' Set a reference to the drawing curve.
Dim oDrawingCurve1 As DrawingCurve
oDrawingCurve1 = oDrawingCurveSegment1.Parent
' Get the mid point of the selected curve
' assuming that the selection curve is linear
Dim oMidPoint As Point2d
oMidPoint = oDrawingCurve1.MidPoint
Dim oDrawingCurveSegment2 As DrawingCurveSegment
oDrawingCurveSegment2 = oDrawDoc.SelectSet.Item(2)
' Set a reference to the drawing curve.
Dim oDrawingCurve2 As DrawingCurve
oDrawingCurve2 = oDrawingCurveSegment2.Parent
' Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
If IsNothing(oPoint) Then
oPoint = oTG.CreatePoint2d(oMidPoint.X + 5, oMidPoint.Y + 5)
End If
' Create a couple of leader points.
Call oLeaderPoints.Add(oPoint)
' Add the GeometryIntent to the leader points collection.
' This is the geometry that the balloon will attach to.
Dim oGeometryIntent As GeometryIntent
oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve1)
Call oLeaderPoints.Add(oGeometryIntent)
' Set a reference to the parent drawing view of the selected curve
Dim oDrawingView As DrawingView
oDrawingView = oDrawingCurve1.Parent
' Set a reference to the referenced model document
Dim oModelDoc As Document
oModelDoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument
' Check if a partslist or a balloon has already been created for this model
Dim IsDrawingBOMDefined As Boolean
IsDrawingBOMDefined = oDrawDoc.DrawingBOMs.IsDrawingBOMDefined(oModelDoc.FullFileName)
Dim oBalloon As Balloon
oBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints)
Dim oGeometryIntent2 As GeometryIntent = _
oActiveSheet.CreateGeometryIntent( _
oDrawingCurve2, oDrawingCurve2.MidPoint)
Dim oLeaderPoints2 As ObjectCollection = _
ThisApplication.TransientObjects. _
CreateObjectCollection
oLeaderPoints2.Add(oGeometryIntent2)
' add a new leader if the leader note has no leader,
' otherwise add a branch leader
If oBalloon.Leader.HasRootNode Then
' add a branch leader based on the root node
oBalloon.Leader.RootNode.AddLeader(oLeaderPoints2)
Else
' add a new leader when
'LeaderNote.Leader.HasRootNode = False
oBalloon.Leader.AddLeader(oLeaderPoints2)
End If
Dim oDrawingBOMRow As DrawingBOMRow
oDrawingBOMRow = oBalloon.BalloonValueSets(1).ReferencedRow
oBalloon.BalloonValueSets.Add(oDrawingBOMRow)
oBalloon.BalloonValueSets(2).OverrideValue = "2x"