That sample does appear long but alot of it is just preparing the conditions to place a balloon. But you need a curve first then what type of curve( example a part with a flat spot on top is probably a good place to attach the leader so selected this curve then you need the point to attach the leader which is the midpoint and then this becomes the intent.
Then you want the position of where to place the balloon center.
Of course if you don't want to ma ually select you need to loop through each occurrence and all the curves and find a nice curve to put the balloon. How you define nice is a users decision. I find the best one in my situation is the top most curve on the elevation view.
From the sample the business pieces. Not a working code.
Dim oLeaderPoints As ObjectCollection
oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
' Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
' Set a reference to the drawing curve segment.
' This assumes that a drwaing 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
' Create a couple of leader points.
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 10))
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 5))
' 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(oDrawingCurve)
Call oLeaderPoints.Add(oGeometryIntent)
' Create the balloon by specifying the level and numbering scheme
oBalloon = oActiveSheet.Balloons.Add(oLeaderPoints, , kStructuredAllLevels, oNumberingScheme
To automate the Command balloon I don't think there is a way to automate this as that command doesn't have any API. To do this will involve mouse moves, control the dialogue box using key strokes. I did attempted it at one stage but made no headway.
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan