Python API - Setting and deleting attributes

andre_f_a_silva97
andre_f_a_silva97 Altair Community Member
edited March 17 in Community Q&A

Hello all,

Does anybody know if it is possible to set and/or delete attributes in Python API?

In short, I wanted to assign a node to a beam element and for that I have my collector "element" and I wrote:
element.directionnode.__setattr__("id",node)

This only works if there is a prior node as reference for the orientation of the beam. If the beam is not oriented based on a reference node (therefore, is referenced by a vector) then it does not work.

I get the message:

AttributeError: "id"

Same thing happens if I want to remove a node from the attribute with

delattr(element.directionnode,"id")

Any clue if this is possible to do?
Thanks