Inventor Customization

Posts: 215
Registered: ‎01-16-2006
Message 1 of 2 (308 Views)
Accepted Solution

Attaching balloon

308 Views, 1 Replies
02-15-2012 01:20 AM

I'm writing a program which attached a balloon to an existing balloon, such as the inventor command  "Attach balloon"

i'm almost there: User selects an existing balloon and a component and gives a direction to draw the balloon and then the balloon is created fine.

The only problem is that i can't connect my balloon to the base balloon. So when i move the base balloon the attached balloon doesn't move with it.


Does anybody know how to do this?




Code: (is part of a larger Auto ballooning program)


PrivateSub CreateAttachBalloon(ByVal oBalloon As Inventor.Balloon)       


     Dim oDrawDoc As Inventor.DrawingDocument

     oDrawDoc = m_inventorApplication.ActiveDocument


     Dim oActiveSheet As Inventor.Sheet

     oActiveSheet = oDrawDoc.ActiveSheet


    Dim oDrawingCurveSegment As Inventor.DrawingCurveSegment           

    Dim oSelect AsNew clsSelect

    oDrawingCurveSegment = oSelect.Pick(Inventor.SelectionFilterEnum.kDrawingCurveSegmentFilter,

                 "Select curve in highlighted component!", Inventor.SelectionFilterEnum.kDrawingCurveSegmentFilter)


     Dim oDrawingCurve As Inventor.DrawingCurve

     oDrawingCurve = oDrawingCurveSegment.Parent


     Dim oTG As Inventor.TransientGeometry

     oTG = m_inventorApplication.TransientGeometry


     Dim oLeaderPoints As Inventor.ObjectCollection

     oLeaderPoints = m_inventorApplication.TransientObjects.CreateObjectCollection


     Dim dBalloonDiameter AsDouble

     dBalloonDiameter = oBalloon.Style.BalloonDiameter


     'user must give direction where to create the balloon           

     Dim Direction AsInteger

     Dim oMouseEvent AsNew MouseEvents(oBalloon)


     DoWhile oMouseEvent.isDone = False


                Direction = oMouseEvent.Direction



     ' Create balloon center point.

       Select Case Direction               

           Case 0

                   Call oLeaderPoints.Add(oTG.CreatePoint2d(oBalloon.Position.X + dBalloonDiameter,

                                   oBalloon.Position.Y - dBalloonDiameter / 2))

            Case 90

                   Call oLeaderPoints.Add(oTG.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y +

                                  dBalloonDiameter / 2))

            Case 180

                   Call oLeaderPoints.Add(oTG.CreatePoint2d(oBalloon.Position.X - dBalloonDiameter,

                                  oBalloon.Position.Y - dBalloonDiameter / 2))

            Case 270

                   Call oLeaderPoints.Add(oTG.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y -

                                  dBalloonDiameter * 1.5))

      End Select


      'Add the GeometryIntent to the leader points collection.

      'This is the geometry that the balloon will attach to.

      Dim oGeometryIntent As Inventor.GeometryIntent

      oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve)


       Call oLeaderPoints.Add(oGeometryIntent)


       Dim oAttachBalloon As Inventor.Balloon

       oAttachBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints)


       'delete all leadernodes

       Dim oLeaderNode As Inventor.LeaderNode

       For Each oLeaderNode In oAttachBalloon.Leader.AllNodes




       'TODO: Attach balloon to base balloon

      Catch ex As Exception


     End Try   

End Sub

Posts: 215
Registered: ‎01-16-2006
Message 2 of 2 (303 Views)

Re: Attaching balloon

02-15-2012 02:27 AM in reply to: GVDB

I already found it!



       Dim oAttachBalloon As Inventor.Balloon

       oAttachBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints)


Dim oBalloonValueSets As Inventor.BalloonValueSets = oBalloon.BalloonValueSets

Dim oBalloonValueSet As Inventor.BalloonValueSet = oBalloonValueSets.Add(oComponentOccurrence)


This will attach balloon!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor