Use AutoCAD Block for Balloon Style

Use AutoCAD Block for Balloon Style

thumel
Contributor Contributor
491 Views
2 Replies
Message 1 of 3

Use AutoCAD Block for Balloon Style

thumel
Contributor
Contributor

Hi All,

 

In Inventor Pro 20017, I need to make a drawing Balloon Style that looks exactly like the AutoCAD block below:

BalloonStyleEx.jpg

 

I created a sketch symbol and set the balloon style to use the symbol and this is what I get:

BalloonStyleEx-1.jpg

 

How can I get the slot shape only around ITEM# (XXX1) and the part iProp (GAR2426) below the slot shape?

 

Thanks for your help,

Terri

0 Likes
Accepted solutions (1)
492 Views
2 Replies
Replies (2)
Message 2 of 3

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

Hi Terri,

 

 

Unfortunately, through balloon style is not possible to place part number below slot shape.

 

It can be achieved by a small automation from VBA code. Before running the code, 2 prerequisites are required.

 

1. Slot shape defined in a sketched symbol and called it as "SlotSymbol" as shown below.

 

SlotSymbol.jpg

 

2. Define a balloon style and called it as "AutoCADStyle". In this, balloon type is set to sketched symbol (SlotSymbol) as shown below. To run the code, balloon name must be "AutoCADStyle".

 

BalloonStyle.jpg

 

After creating sketched symbol and balloon style, run the following sample VBA code.

 

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
    Set oStyle = oDrawDoc.StylesManager.BalloonStyles.Item("AutoCADStyle")

    oStyle.Properties = "FormatID='{32853F0F-3444-11d1-9E93-0060B03C1CA6}'PropertyID='5'"

    oBalloon.Style = oStyle

    Dim s As String
    s = oBalloon.BalloonValueSets.Item(1).Value

    oStyle.Properties = "PartsListProperty='45572'"

    oBalloon.Style = oStyle

    Dim txtPt As Point2d
    Set txtPt = ThisApplication.TransientGeometry.CreatePoint2d(oBalloon.Position.X, oBalloon.Position.Y)
    txtPt.X = txtPt.X
    txtPt.Y = txtPt.Y - oBalloon.Style.BalloonDiameter

    Dim oText As Inventor.GeneralNote
    Set oText = oDrawDoc.Sheets.Item(1).DrawingNotes.GeneralNotes.AddFitted(txtPt, s)

    Set txtPt = ThisApplication.TransientGeometry.CreatePoint2d(oText.Position.X, oText.Position.Y)

    Dim wide As Double
    wide = oText.Width

    txtPt.X = txtPt.X - (wide / 2)

    oText.Position = txtPt
    
End Sub

On running the code, a prompt will appear to select a balloon. After successful balloon selection, a text will be created below slot shape. Text contains respective part number of the selected balloon.

 

Please feel free to contact if there is any doubt.

 

If solves your problem, click on "Accept as solution" or give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 3

thumel
Contributor
Contributor
Thank-you for the response! I will try the running the VBA code as you suggested. However, I was able to make the Balloon look the way the AutoCAD block looks by leaving spaces for the attribute values then importing the block into Inventor as a symbol. See below:
[cid:image002.jpg@01D2CFD4.E3CC0220]
0 Likes