Inventor Customization

Reply
Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 1 of 9 (412 Views)

Store information in a balloon

412 Views, 8 Replies
11-16-2012 01:00 PM

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
Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 2 of 9 (397 Views)

Re: Store information in a balloon

11-19-2012 06:38 AM 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
ADN Support Specialist
Vladimir.Ananyev
Posts: 458
Registered: ‎08-14-2012
Message 3 of 9 (365 Views)

Re: Store information in a balloon

11-26-2012 04:30 AM 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

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 4 of 9 (359 Views)

Re: Store information in a balloon

11-26-2012 05:08 AM 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
ADN Support Specialist
Vladimir.Ananyev
Posts: 458
Registered: ‎08-14-2012
Message 5 of 9 (335 Views)

Re: Store information in a balloon

11-27-2012 06:53 AM 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

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 6 of 9 (332 Views)

Re: Store information in a balloon

11-27-2012 07:06 AM 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
ADN Support Specialist
Vladimir.Ananyev
Posts: 458
Registered: ‎08-14-2012
Message 7 of 9 (310 Views)

Re: Store information in a balloon

11-28-2012 07:00 AM in reply to: bsee1

We have no API to attach attributes to BalloonValueSet  :smileysad:

 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

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 8 of 9 (307 Views)

Re: Store information in a balloon

11-28-2012 07:16 AM 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
ADN Support Specialist
Vladimir.Ananyev
Posts: 458
Registered: ‎08-14-2012
Message 9 of 9 (301 Views)

Re: Store information in a balloon

11-28-2012 08:08 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube