AttributeSet.Add method - how to add attribute

AttributeSet.Add method - how to add attribute

Cris-Ideas
Advisor Advisor
540 Views
3 Replies
Message 1 of 4

AttributeSet.Add method - how to add attribute

Cris-Ideas
Advisor
Advisor

Hi,

I have a problem with adding attributes to an attribute set.

Attribute set was created and I can print its name, so I assume it is there

 

I now need to add attributes to the set.

But cannot get Add method to work.

 

Can someone en-light me how do I add attribute? (I need various types: string, byte array, boolean.)

I tried like this:

attr = occAttributeSet.Add("0001TopName", ValueTypeEnum.kStringType, SattrName)

and like this:

occAttributeSet.Add("0006DefaultInPre", ValueTypeEnum.kStringType, "Off")

But I am getting run time exception every time.

 

Cris.

Cris,
https://simply.engineering
0 Likes
541 Views
3 Replies
Replies (3)
Message 2 of 4

martin.jacko
Autodesk
Autodesk

Hi,

 

As first use attSet.NameIsUsed[attName] to check attribute with given name already exists.  Then check if attset is not null. Latest problem can be using attributeSets instead of attributeSet.

In inventor structure is AttributeSets-AttributeSet-Attribute.

 

Thanks,

Martin

0 Likes
Message 3 of 4

Cris-Ideas
Advisor
Advisor

In this particular case it turned out that name of the attribute cannot start with digit.

 

Cris.

Cris,
https://simply.engineering
0 Likes
Message 4 of 4

AlexFielder
Advisor
Advisor
Useful to know, thanks for sharing!
0 Likes