We've used Inventor professional here for a number of years and struggled with attaching qty text on all 4 quadrants of the balloon based on location of the leader. I've created a symbol with prompted text (displays as '#"X) but that doesn't help me attach it to the center of a balloon (can't be done) plus it's another step done after the balloons are placed.
Ultimately see the attached image to see what I want to be created when I attach a balloon. The qty beside the balloon is the qty for that particular area of interest, not the whole view nor the whole dwg.
Using Inventor Professional 2015
64-Bit Edition
Thanks for your help.
BR,
Michael Wardas
Solved! Go to Solution.
Solved by chandra.shekar.g. Go to Solution.
Hello Michael,
Can't you use the built in split balloon to do this?
see my screencast: http://autode.sk/2oN3tlR
Thanks for the response.
However I'm looking to specify a qty for a particular area of interest as opposed to the total BOM qty as per my previous attached example.
Hi Michael,
Please find the following VBA code to draw the text across 3'0 clock and 9'o clock. Similarly, the code can be extended for 9'o clock and 12'o clock.
On running this code, it will ask to select a balloon. After selection, 2 texts are generated and positioned at 3'o clock and 9'o clock.
Sub Main() Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oBalloon As Balloon Set oBalloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter, "Select a balloon") Dim oStyle As BalloonStyle For Each oStyle In oDrawDoc.StylesManager.BalloonStyles If oStyle.Name = "Balloon Qty" Then Set oStyle = oDrawDoc.StylesManager.BalloonStyles.Item("Balloon Qty") End If Next If oStyle Is Nothing Then Set oStyle = oDrawDoc.StylesManager.BalloonStyles.Item(1).Copy("Balloon Qty") End If oStyle.BalloonType = BalloonTypeEnum.kCircularWithOneEntryBalloonType oStyle.Properties = "PartsListProperty='45575'" oBalloon.Style = oStyle Dim strQty As String strQty = oBalloon.BalloonValueSets.Item(1).Value strQty = strQty & "X" oBalloon.Style = oDrawDoc.StylesManager.BalloonStyles.Item(1) oBalloon.SetBalloonType (BalloonTypeEnum.kCircularWithOneEntryBalloonType) Call oStyle.Delete Dim txtPt3o As Point2d Set txtPt3o = ThisApplication.TransientGeometry.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y) txtPt3o.X = txtPt3o.X + oBalloon.Style.BalloonDiameter / 2 txtPt3o.Y = txtPt3o.Y + oDrawDoc.StylesManager.TextStyles.Item(1).FontSize / 2 Dim oText3o As Inventor.GeneralNote Set oText3o = oDrawDoc.Sheets.Item(1).DrawingNotes.GeneralNotes.AddFitted(txtPt3o, strQty) Dim txtPt9o As Point2d Set txtPt9o = ThisApplication.TransientGeometry.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y) txtPt9o.X = (txtPt9o.X - (oBalloon.Style.BalloonDiameter / 2)) - (oDrawDoc.StylesManager.TextStyles.Item(1).WidthScale * 0.6) txtPt9o.Y = txtPt9o.Y + oDrawDoc.StylesManager.TextStyles.Item(1).FontSize / 2 Dim oText9o As Inventor.GeneralNote Set oText9o = oDrawDoc.Sheets.Item(1).DrawingNotes.GeneralNotes.AddFitted(txtPt9o, strQty) End Sub
Please feel free to contact if there is any doubt.
If solves your problem, click on "Accept as solution" / give a "Kudo"
Thanks and regards,
This works great!
I will try to add the 12 and 6 oclock positions.
Is there an easy way to be 'prompted' for the text when inserting so I don't have to go back and edit?
Many thanks!
One other thing is it easy to make the text follow the balloon like a symbol?
I just tried messing around to see if you could attach a leader to the balloon so then you could use a leader note that would follow it... but that failed.
So it looks like you would have to use assets or something to locate the balloon and catch the balloon location changes with an event and relocate the text notes in relation to the new geometry...
'This attached code is test I did with LeaderNotes that failed when trying to use it with balloons. Even in the API documentation, none of the objects listed for valid geometry intent include balloons...
Sub Main() oDrawDoc = ThisApplication.ActiveDocument 'Dim oBalloon As Balloon 'oBalloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter, "Select a balloon") oBalloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select a balloon") Call AddGenNoteWithLeader(oBalloon) End Sub Dim oDrawDoc As DrawingDocument Sub AddGenNoteWithLeader(oBalloon As Object) Dim ballPt3o As Point2d ballPt3o = ThisApplication.TransientGeometry.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y) Dim txtPt3o As Point2d txtPt3o = ThisApplication.TransientGeometry.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y) txtPt3o.X = ballPt3o.X + 5'+ oBalloon.Style.BalloonDiameter / 2 txtPt3o.Y = ballPt3o.Y + 4'+ oDrawDoc.StylesManager.TextStyles.Item(1).FontSize / 2 Dim oLeaderPoints As ObjectCollection oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection 'Where to place the text oLeaderPoints.Add(txtPt3o) 'What to attach leader arrow to Dim oGeometryIntent As GeometryIntent 'oGeometryIntent = ThisApplication.ActiveDocument.ActiveSheet.CreateGeometryIntent(oCurve) 'oGeometryIntent = oDrawDoc.ActiveSheet.CreateGeometryIntent(ballPt3o, ballPt3o) oGeometryIntent = oDrawDoc.ActiveSheet.CreateGeometryIntent(oBalloon) oLeaderPoints.Add(oGeometryIntent) Dim oText3o As Inventor.LeaderNote Try oText3o = oDrawDoc.Sheets.Item(1).DrawingNotes.LeaderNotes.Add(oLeaderPoints, "Hey") oText3o.LeaderVisible = False Catch MsgBox("You is has failed") End Try End Sub
Hi Micheal,
One other thing is it easy to make the text follow the balloon like a symbol?
Please name the symbol with example image. Let you know the possibility.
Is there an easy way to be 'prompted' for the text when inserting so I don't have to go back and edit?
Yes, It can be achieved through a Windows application which contains textbox.
Required text can be entered in that textbox.
Thanks and regards,