Add Formatted XML text as String Attribute Value to a Face?

Add Formatted XML text as String Attribute Value to a Face?

amitabhVA4SD
Advocate Advocate
1,105 Views
8 Replies
Message 1 of 9

Add Formatted XML text as String Attribute Value to a Face?

amitabhVA4SD
Advocate
Advocate

Hello All,

 

This might sound like a whacky idea but I want to pick the brains of experienced Inventor forum members on the idea of adding a formatted text like XML as a string attribute on an Inventor Face to store some additional information of the Face.

Is there any limitation to the number of characters that can be accommodated in the value field of a String Attribute (not iProperty)? Any challenges that I may face using special characters in the value?

The reason I want to store an entire serialized XML structure as a single attribute is to quickly get back the object structure using de-serialization from a single attribute.

 

I tried this using @BrianEkins Nifty Attribute AddIn and it is accepting the data. The Formatted Text button is also showing the XML data in a nice format.

I did not face any challenge saving the file with this information, but will it have any challenges with Autodesk Vault?

 

Please see the image below

The XML content is not relevant to my requirement and is merely used as a test. I will be replacing this with the correct XML content once the feasibility is complete.

Autodesk API Team Please help!

@MjDeck  @johnsonshiue @JelteDeJong @YuhanZhang 

amitabhVA4SD_0-1633707808655.png

 

Thanks,

Amitabh Mukherjee

0 Likes
1,106 Views
8 Replies
Replies (8)
Message 2 of 9

MjDeck
Autodesk
Autodesk

@amitabhVA4SD, this should work fine. There no restrictions on the amount of data in an Attribute, and no special characters. You could also use a byte array instead of a string.
There are some restrictions on the attribute name, but not the contents.
As far as I know Vault doesn't look at Attribute data at all.


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 9

Michael.Navara
Advisor
Advisor

In my opinion there is no limit for string length. I use attributes for storing data in XML too and I never had any problem with it.

Autodesk Vault can't read data from attributes (unfortunately). 

Message 4 of 9

JelteDeJong
Mentor
Mentor

There is not much that I can add. I know that iLogic rules are also saved as attributes of the document. I wrote quite long rules and never had problems with the size or with the vault.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 5 of 9

amitabhVA4SD
Advocate
Advocate

@MjDeck- What are the restrictions w.r.t the Attribute Names? Is it mentioned in the documentation?

0 Likes
Message 6 of 9

amitabhVA4SD
Advocate
Advocate

@Michael.Navara- Thank you, for the Vault confirmation. That helps!

0 Likes
Message 7 of 9

amitabhVA4SD
Advocate
Advocate
Thank you for the prompt reply.
0 Likes
Message 8 of 9

MjDeck
Autodesk
Autodesk

@amitabhVA4SD , I did a check for the restrictions on AttributeSet and Attribute names but I don't have a full list of valid characters. Here are some invalid ones : space ! <  > &
They can't start with a numeric digit.
So they are similar in some ways to variable names in Visual Basic.
Space is mentioned on this page. We should provide more documentation.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 9 of 9

Michael.Navara
Advisor
Advisor

It is not documented, but attributes are stored as XML. According to this the limitations of names are described here

https://www.w3schools.com/xml/xml_elements.asp

 

You can use this simple VBA

 

Sub GetAttSets()
    'Get any attribute sets from any object which contains any attribute
    Dim attSets As AttributeSets
    Set attSets = ThisApplication.ActiveDocument.ComponentDefinition.AttributeSets
    
    Dim formats() As String
    Dim storageTypes() As StorageTypeEnum
    Call attSets.DataIO.GetOutputFormats(formats, storageTypes)
    Stop
    
    Call attSets.DataIO.WriteDataToFile("XML", "C:\Temp\AttributeSets.xml")
    Stop
    
End Sub

 

code for better understanding

 

 

0 Likes