Add-ins: Best way to store AddIn-specific information in a document

Add-ins: Best way to store AddIn-specific information in a document

DRoam
Mentor Mentor
694 Views
4 Replies
Message 1 of 5

Add-ins: Best way to store AddIn-specific information in a document

DRoam
Mentor
Mentor

Another add-in question. I have some iLogic rules that use parameters and iProperties to populate multi-value lists, and store information about the part, such as "Part Type" (Plate, Flat Bar, Angle, etc.).

 

Now that I'm moving to an add-in, those parameters and iProperties aren't really necessary. They don't need to be visible to the user anywhere (directly); they just need to be stored in the document to be read/written by the add-in. The add-in will use them and present them to the user in Forms if necessary.

 

I recently learned about AttributeSets and Attributes. Are these the best way to store document-specific information for an add-in? Or is there a better way?

 

I've also just heard of "DocumentInterests" for the first time and it sounds applicable. Should I incorporate this as well?

0 Likes
Accepted solutions (1)
695 Views
4 Replies
Replies (4)
Message 2 of 5

pball
Mentor
Mentor

Haven't used them myself but there are hidden iProperties you can create. I have a code sample in the post below. I can't comment on which method might be best, it might end up being what is easiest to implement for you.

 

https://forums.autodesk.com/t5/inventor-customization/any-unique-property-for-differentiate-inventor...

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
Message 3 of 5

DRoam
Mentor
Mentor

Thanks @pball, I'd forgotten about those. From what I can tell, their capabilities are essentially identical with Attributes. I tried to find some information on why to use one over the other, but I couldn't find this discussed anywhere. So I created a thread for that question specifically here: Document Attributes vs. custom PropertySets (hidden iProperty sets).

 

If anyone uses any other methods, besides attributes and properties, to store document-specific information for add-ins, please let me know.

0 Likes
Message 4 of 5

AlexFielder
Advisor
Advisor
Accepted solution

There's no point reinventing the wheel, so I would either:

 

a) create custom iProperties

or

b) make us of attributesets and attributes (which is all iProperties are under the surface)

 

Brian Ekins Attribute Helper will make the latter easier to achieve/understand.

 

Good luck!

Message 5 of 5

DRoam
Mentor
Mentor

Thanks Alex, so it sounds like iProperties and Attributes are the best options. And it sounds like between the two, Attributes are the way to go, at least for Add-in purposes. Here's a quote from Mike Deck on the other thread: 

 


@MjDeck wrote:

Overall, AttributeSets are better. The API is richer. A disadvantage of PropertySets is that there is a limit on the total amount of combined storage for names and values. I haven't checked recently, but it might still be as low as 1MB.
The AttributeHelper add-in is useful for viewing and editing.


Attributes have a couple other advantages, as well. They can be created as "transient" (so they only last for the current session), and they can also store a "byte array" (although I'm not sure what that would be used for).

 

So I'll probably be using Attributes, unless it's something I want the user to have easy access to or to be showable in the BOM, in which case I'll use the good old "Inventor User Defined Properties" PropertySet (i.e. Custom iProperties).

 

Thanks for the suggestions!

0 Likes