Balloon Locations

Balloon Locations

Anonymous
Not applicable
1,776 Views
9 Replies
Message 1 of 10

Balloon Locations

Anonymous
Not applicable

Hi All

 

I am looking for a routine or to see if it is possible to do the following.

 

When creating a Multi sheet drawing we have a column in the BOM that identifies the sheet and zone that a item is first ballooned in. We currently enter this information in to the BOM manually and we would like to automate the process to remove the user errors when doing the task.

 

Has anyone made such a routine, or is it possible to do there VBA?

 

Cheers

Mike

0 Likes
Accepted solutions (1)
1,777 Views
9 Replies
Replies (9)
Message 2 of 10

ekinsb
Alumni
Alumni

This should be possible.  One question.  Is the zone that's specified in the BOM, the zone where the balloon is located or the zone where the part is located?  I assume the balloon, but just wanted to check.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 10

Anonymous
Not applicable

Yes the zone called out in the BOM is the zone where the balloon is located.

 

Thanks

Mike

0 Likes
Message 4 of 10

ekinsb
Alumni
Alumni
Accepted solution

Take a look at this.  It doesn't do the BOM portion of what you wanted but it does figure out all of the balloon information that you need. 

 

http://modthemachine.typepad.com/my_weblog/2010/09/balloon-reporting-macro.html

 

Thanks for providing me some blog material. 🙂


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 5 of 10

Anonymous
Not applicable

Hi Brian

 

We have been using your balloon location Macro, and it works quite well. One of your guys tweaked it slightly to work with our templates. We would like to know if it is possible for the macro to differentiate between a standard balloon and a balloon that has had an override applied to it.

 

We typically use a split balloon the first time an item is called out on a drawing (split balloon contains item number and total quantity) and a balloon with an override so it shows only the item number for the other places the item is called out on the drawing.

 

So the million dollar question is can the Macro tell the difference between these two balloon types? We have not been able to find the key for that.

 

Thanks in advance,

Mike

0 Likes
Message 6 of 10

ekinsb
Alumni
Alumni

You can use the Balloon.GetBalloonType method to determine this.  For the standard balloon it will return kCircularWithOneEntryBalloonType as the type and for the split balloon you'll get kCircularWithTwoEntriesBalloonType.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 7 of 10

Anonymous
Not applicable

Brian,

 

I stumbled upon this topic yesterday while researching ways to put the balloon location for each component into the parts list of multi-sheet assembly drawings.  I tried your provided macro and it worked perfectly the first time, writing a text file to C:\Temp with the locations of each balloon on each sheet.

 

Since I have rather limited exposure to macro's and VBA, I am posing a few rooky questions:

 

1)  Is it possible to have this sheet and zone data auto-populated into the parts list of the assembly drawing?  If not...

2)  Is it possible to have this sheet and zone data auto-populated into a seperate table, similar to a hole location table?  If not...

3)  Is it possible to have the data from the text file automatically exported to an excel file so that it can be easily imported into a table?

 

I'm trying to make this process as simple as possible for our cad techs.  Our engineering manager would really like to have this info on our assembly drawings, many of which run 10 or more pages long with upward of 200 individual components.  It would be great if we could accomplish this with as few key strokes as possible by the cad tech in order to speed the process with the least potential for errors.

 

Thanks so much for your help.  I can tell that I will be relying on this forum quite a bit in the future.

 

Ken Hosey

Manufacturing Engineer

Globe Motors, Inc.

0 Likes
Message 8 of 10

ekinsb
Alumni
Alumni

Wow! I had totally forgotten I had written that.  The easiest thing is your last suggestion.  It just requires a slight edit to the existing program to write out the data into a csv file.  Creating a new custom table wouldn't be very hard either but a bit more work.  I can't remember all of the details of working with parts lists right now so I'm not sure adding it to the parts list will work but even if that is possible it would be the most work.  Here's a quick edit to the existing program to write out a csv file.  After making this change it would be best to have it create the tables so you can create a table per sheet. Right now this creates a single table for all sheets because all of the balloons for all sheets are being written into the file.  It's most a matter of design and figuring out how the program should behave and then making it do that should be fairly easy.

 

Public Sub BalloonReport()
  ' Get the active drawing document.
  Dim drawDoc As DrawingDocument
  Set drawDoc = ThisApplication.ActiveDocument

  ' Open a file to write the results into.
  Dim filename As String
  filename = "C:\Temp\BalloonReport.csv"
  Open filename For Output As #1

  ' Print out the header for the report, both to the
  ' output file and the immediate window in VBA.
  Debug.Print "Sheet, Balloon Value, Sheet Position"
  Print #1, "Sheet, Balloon Value, Sheet Position"

  ' Iterate through the sheets.
  Dim drawSheet As Sheet
  For Each drawSheet In drawDoc.Sheets
    ' Determine the zones within this sheet.  This assumes that
    ' the border was created as a standard border where the
    ' zones are explicitly defined.  If this is a custom border
    ' then some other mechanism will need to be created to
    ' define the zones.
    Dim border As DefaultBorder
    Set border = drawSheet.border
    Dim XZoneWidth As Double
    Dim YZoneWidth As Double
    XZoneWidth = drawSheet.Width / border.HorizontalZoneCount
    YZoneWidth = drawSheet.Height / border.VerticalZoneCount
    Dim XZoneIsNumber As Boolean
    If border.HorizontalZoneLabelMode = kBorderLabelModeNumeric Then
        XZoneIsNumber = True
    Else
        XZoneIsNumber = False
    End If

    Dim YZoneIsNumber As Boolean
    If border.VerticalZoneLabelMode = kBorderLabelModeNumeric Then
      YZoneIsNumber = True
    Else
      YZoneIsNumber = False
    End If

    ' Iterate through the balloons on this sheet.
    Dim drawBalloon As Balloon
    For Each drawBalloon In drawSheet.Balloons
      ' Because the border is numbered in the X direction from
      ' right to left and the sheet coordinate system is from
      ' left to right, this reverses the X coordinate so the
      ' zone computation will be correct.
      Dim newXPosition As Double
      newXPosition = drawSheet.Width - drawBalloon.Position.x

      ' Determine the X zone.
      Dim XZone As Integer
      XZone = Int(newXPosition / XZoneWidth)

      ' Get the X zone as a string.
      Dim XZoneValue As String

      If XZoneIsNumber Then
        XZoneValue = XZone + 1
      Else
        XZoneValue = Chr(XZone + 65)
      End If

      ' Determine Y zone.
      Dim YZone As Integer
      YZone = Int(drawBalloon.Position.y / YZoneWidth)

      ' Get the Y zone as a string.
      Dim YZoneValue As String
      If YZoneIsNumber Then
        YZoneValue = YZone + 1
      Else
        YZoneValue = Chr(YZone + 65)
      End If

      ' Iterate through each value set associated with this balloon.
      Dim valueSet As BalloonValueSet
      For Each valueSet In drawBalloon.BalloonValueSets
        ' Print out the results for this value set.
        Debug.Print """"; drawSheet.name & """,""" & valueSet.value & """,""" & XZoneValue & ", " & YZoneValue & """"
        Print #1, """"; drawSheet.name & """,""" & valueSet.value & """,""" & XZoneValue & ", " & YZoneValue & """"
      Next
    Next
  Next

  ' Close the output file.
  Close #1

  MsgBox "Report written to: """ & filename & """"
End Sub

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 9 of 10

Anonymous
Not applicable

Excellent!  Thanks, Brian.  With some very minor tweeking, this will give us a usable spreadsheet from which I can produce a table on the drawing indicating the sheets and locations.

 

Kudos, Sir,

 

Ken

0 Likes
Message 10 of 10

Anonymous
Not applicable

As regards to the code, it does work but I am experiences a bug with the auto-populate balloon zones. When ran, I get the error in a 'Microsoft Visual Basic' window: 

 

Run-time error '5':

Invalid procedure call or argument

 

And when I click 'debug', it takes me to the following line of code:

 

YZoneValue = Chr(YZone + 65)

 

I'm assuming the zone range is too large. Any ideas?

0 Likes