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: 

Store information in a balloon

8 REPLIES 8
Reply
Message 1 of 9
bsee1
817 Views, 8 Replies

Store information in a balloon

I'm using balloons to get information from parts, then writing that part info to a custom table.  I need to keep track of which balloon corresponds to which table row.

 

Is there some object/property of Balloon where I can store a single number or string?  I'm already using the value field, so that's unavailable to me.  

 

Also, one balloon corresponds to one table entry.  That means I cannot create a custom iProperty in the part the balloon is attached to since more than one balloon may reference the same part.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
8 REPLIES 8
Message 2 of 9
bsee1
in reply to: bsee1

New approach to this.  It appears Attributes may do what I want.  However, Attributes only appear to be available for balloons, not Balloon AttributeSets.  

 

My understanding is that if a balloon is attached to another balloon, that is considered one balloon with 2 attribute sets.  Is it possible to assign an attribute to each AttributeSet in a balloon?  Is there something else that might work better?

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 3 of 9
Vladimir.Ananyev
in reply to: bsee1

Reference to the DrawingBOMRow is accessible from the reference to the Balloon object. Inventor 2013 API Help contains the sample that shows how we find component referenced by balloon. Here it is:

 

Public Sub GetComponentReferencedByBalloon()
    ' Set a reference to the active drawing document
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    ' Get the selected balloon
    Dim oBalloon As Balloon
    Set oBalloon = oDoc.SelectSet(1)
    
    Dim oBalloonValueSet As BalloonValueSet
    For Each oBalloonValueSet In oBalloon.BalloonValueSets
        Dim strDisplay As String
        strDisplay = "Balloon Item Number: "
        
        ' Add the balloon item number (the overridden value if there is one)
        If oBalloonValueSet.OverrideValue = "" Then
            strDisplay = strDisplay & oBalloonValueSet.Value
        Else
            strDisplay = strDisplay & oBalloonValueSet.OverrideValue
        End If
        
        Dim oDrawingBOMRow As DrawingBOMRow
        Set oDrawingBOMRow = oBalloonValueSet.ReferencedRow
        
        If oDrawingBOMRow.Custom Then
            ' The referenced item is a custom parts list row.
            strDisplay = strDisplay & vbNewLine & "Referenced Component(s):"
            strDisplay = strDisplay & vbNewLine & "     Custom PartsList Row"
        Else
            Dim oBOMRow As BOMRow
            Set oBOMRow = oDrawingBOMRow.BOMRow
            
            ' Add the Item Number from the model BOM.
            strDisplay = strDisplay & vbNewLine & "BOM Item Number: " & oBOMRow.ItemNumber
            
            strDisplay = strDisplay & vbNewLine & "Referenced Component(s):"
            
            Dim oCompDefs As ComponentDefinitionsEnumerator
            Set oCompDefs = oBOMRow.ComponentDefinitions
               
            If oDrawingBOMRow.Virtual Then
                ' The referenced item is a virtual component.
                strDisplay = strDisplay & vbNewLine & "     Virtual: " & oCompDefs.Item(1).DisplayName
            Else
              
                ' Add the document name of the referenced component.
                ' There could be multiple if the balloon references
                ' a merged BOM row in the model.
                Dim oCompDef As ComponentDefinition
                For Each oCompDef In oCompDefs
                    strDisplay = strDisplay & vbNewLine & "     " & oCompDef.Document.FullDocumentName
                Next
                
            End If
        End If
        MsgBox strDisplay
    Next
End Sub

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 4 of 9
bsee1
in reply to: Vladimir.Ananyev

Right, and I'm using code from the sample.  I have that part working.

 

I'm doing something different.  Each Balloon can have multiple ValueSets, and each ValueSet corresponds to a part.  I can't store the information in the part itself, because each part may have more than one balloon (multiple balloons would mean more than one table entry in my custom table).  Therefore, I need a way to make the balloon Valueset correspond to a custom table row I'm creating.  

 

I either need a way to uniquely identify balloon ValueSets(like a sketch's refKey), or I need a way to store a very small amount of data with a balloonValueSet.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 5 of 9
Vladimir.Ananyev
in reply to: bsee1

You have classic many-to-many relationship between balloons
and parts represented by DrawingBomRow objects.

What information do you need to extract from DrawingBOM and
balloons in order to be saved in your custom table?

Can you please clarify desired workflow in more detail?


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 6 of 9
bsee1
in reply to: Vladimir.Ananyev

The user will balloon parts.  I'll be creating a parts list that only includes the parts the user has ballooned.  Each balloon placed will correspond to a single table entry, and each table entry will have a description.  I need to keep this description linked to the proper balloon.  Also, since parts may be used more than once, different instances of the part may have different descriptions.

 

One table row includes 5 columns: ID, Description, Manufacturer, Part Number, Internal Part Number

 

There's also the case where the user will attach a balloon(valueSet) from list because they may not be able to see the part they're selecting.  This is why the info must be stored in the valueSet object within the balloon, not the balloon object itself.

 

Also, the balloons will have ID values.  This ID value is also in the table.  This allows the user to find the part info in the table, then use the ID number to identify which balloon has that info.

 

That's a very complete description of the whole workflow.  I have most of that done, but maintaining a link between the tablerow entry and the balloonValueSet is tricky when I have nowhere to store a string of data in the valueSet.  

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 7 of 9
Vladimir.Ananyev
in reply to: bsee1

We have no API to attach attributes to BalloonValueSet  😞

 BUT if “Each balloon placed will correspond to a single table entry” with unique description then you may use the following workaround.

  1. In Balloon object we could create several AttributeSet objects – one set for every table entry and save in attributes ID and Description from this entry + info from associated BalloonValueSet.
  2. In table row you could save attributes of all associated balloons.

AttributeManager.FindObjects method allows you to find references to appropriate balloon by ID and required description. This info allows locate associated BalloonValueSet if needed.

The reference to BalloonValueSet allows find ID and Description in balloon attributes. This data can be used to find table row associated with this BalloonValueSet.

 

Not very convenient but could work.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 8 of 9
bsee1
in reply to: Vladimir.Ananyev

You seem to suggest that I store an attributeSet in a tableRow.  From what I can tell, tableRow does not have an attributeSet.  I believe the attributeSet is in the tableObject itself.  I'd then have to create a new attribute in the table for every row. 

 

You're right, it probably would work.  However, I think it makes more sense for me to find a different approach.   Thank you for the effort to assist me.

 

As a request to Autodesk,if you would consider adding some sort of storage for every programmatic entity created by Autodesk, visible to a programmer but invisible to the user, that would allow for far greater flexibility.  

 

AttributeSets work great, but I believe only visible objects have them. Child items of visible objects need them as well for them to be useful.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 9 of 9
Vladimir.Ananyev
in reply to: bsee1

Could you please add this request to Inventor API wish list here:

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1109794

 

Thanks and best regards!


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report