Whether it is possible to add a function that returns the type of the element.

Forum for asking and answering questions related to use of the OpenSeesPy module

Moderators: silvia, selimgunay, Moderators

Post Reply
YanYang
Posts: 13
Joined: Tue Jun 02, 2020 7:09 pm

Whether it is possible to add a function that returns the type of the element.

Post by YanYang » Fri Jan 07, 2022 3:51 am

Dear Prof. Scott and Dr. Zhu.
Due to the need of visualizing the model, is it possible to add an OpenSeesPy function to return the type of the element? For example, like this.

Code: Select all

ele_type = ops.eleType(eleTag)
print(ele_type)
'dispBeamColumn'.
Thanks for your great work for OpenSees.

firai
Posts: 1
Joined: Tue Apr 19, 2022 9:09 am

Re: Whether it is possible to add a function that returns the type of the element.

Post by firai » Tue Apr 19, 2022 9:35 am

A similar command exists: getEleClassTags(). The command doesn't seem to be documented in either the OpenSeesPy or the OpenSees docs, but opsvis and vfo both use it. As far as I can tell, the usage is (type hints written in PEP 484 format):

Code: Select all

getEleClassTags(element_tag: int) -> List[int]
I'm not sure why the function returns the (singular) element class tag in a list, considering that it only accepts one input element tag, but that's how it is. Also, the output needs to be decoded based on the lookup in classTags.h in the OpenSees/OpenSeesPy source code. Again, opsvis and vfo already have some of the common types incorporated in their source code, so you can refer to those to start with.

I agree that having a function that returns the type as a string directly would be easier for most people to use though.

Post Reply