Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add attribute to edge through intent

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
702 Views, 2 Replies

Add attribute to edge through intent

I would like to add an attribute to an edge using the Inventor API through intent. I have been able to add the attribute set, but when I try to add the attribute to the set, I get errors saying that the Add method doesn't exist. My code:

intent_attribute = intent_attributeset.Add("Name", 14595, "some_name")

It appears as though the error comes from the fact that the Inventor API is expecting the second parameter in the call (14595) to be an enum value (ValueTypeEnum.kStringType), and not the integer value. How do I pass the kStringType to the call? When I try to use ValueTypeEnum.kStringType, I get the error:

"Unknown failure in Conversion::FromIntentValue()".

How do I add attributes to an attribute set?

Thanks!

Mike
2 REPLIES 2
Message 2 of 3
AlexKorzun
in reply to: Anonymous

Hi Michael,

The Intent code below adds or changes the value of the string attribute on a face (or anything else that has .AttributeSets property). Full type name (with namespace) should be used: {color:#ff9900}{color:#0000ff}Inventor.ValueTypeEnum.kStringType{color}:{color}

Method AddIntentAttribute( face As Any, attName As String, attValue As String) As Any
Dim attss = face.AttributeSets
Dim atts 'Attributeset

If( attss.get_NameIsUsed("Intent")) Then
atts = attss.get_Item("Intent")
Else
atts = attss.Add("Intent")
End If

Dim att 'Attribute
If( atts.get_NameIsUsed( attName))Then
att = atts.get_Item(attName)
att.Value = attValue
Else
att = atts.Add( attName, {color:#0000ff}Inventor.{color}ValueTypeEnum.kStringType, attValue)
End If

Return att.Name + ": " + att.Value
End Method

Thank you,

--Alex Korzun
Intent Development




Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks, That worked!

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

Post to forums  

Autodesk Design & Make Report