Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attaching balloon

1 REPLY 1
SOLVED
Reply
Message 1 of 2
GVDB
757 Views, 1 Reply

Attaching balloon

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?

 

Geert

 

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

 

PrivateSub CreateAttachBalloon(ByVal oBalloon As Inventor.Balloon)       

Try           

     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

                m_inventorApplication.UserInterfaceManager.DoEvents()

                Direction = oMouseEvent.Direction

      Loop

           

     ' 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

                oLeaderNode.Delete()

       Next

          

       'TODO: Attach balloon to base balloon


      Catch ex As Exception

       

     End Try   

End Sub

1 REPLY 1
Message 2 of 2
GVDB
in reply to: GVDB

I already found it!

 

replace:

       Dim oAttachBalloon As Inventor.Balloon

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

By:

Dim oBalloonValueSets As Inventor.BalloonValueSets = oBalloon.BalloonValueSets

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

 

This will attach balloon!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report