🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Python API - Setting and deleting attributes

User: "andre_f_a_silva97"
Altair Community Member
Updated by Michael Herve

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

 

Find more posts tagged with