Node Coords & Mass¶
[4]:
# import OpenSeesPy and demo modElement
import openseespy.opensees as ops
from opsparser import OpenSeesParser
from ArchBridge2 import ArchBridge2
[5]:
# first hook all commands before your opensees code
parser = OpenSeesParser(ops)
parser.hook_all()
# some Elementse may have provided some code
ArchBridge2()
Challenge: Determining appropriate new tag values for modElement components¶
when you want to add some code after existing code, you may find it difficult to know which new tag to use
sometimes during parametric studies, change of Elementesize(occupying more tags) becomes problematic due to cascade effect
Common approaches:
Using large numbers (e.g., 10001, 20001) to avoid conflicts
Configure another way to allocate tags with a little time(but annoying)
Solution: Using automated tag management¶
We provide two methods for this purpose:
newtagproperty: Returns a single new unused tagnewtag_upperproperty: Returns a single new unused tag that is max of all tags + 1get_new_tags(num:int, start:int = 1): Returns a list of ‘num’ new unused tags
[6]:
from opsparser import OpenSeesCommand as Command
# Example of adding a new node:
Node = Command.NODE.instance
print(Node.newtag) # in this case 242
print(Node.newtag_upper) # in this case also 242
# but what will happen after adding a new node?
ops.node(Node.newtag+10, *[-1,-1,-1])
print(Node.newtag) # This value remains unchanged until you actually use ops.node(Node.newtag, *coords)
print(Node.newtag_upper) # in this case not 242
242
242
242
253
[7]:
# and you can also get a list to build your modElement if you want, like:
print("5 newtag list:")
for tag in Node.get_new_tags(5):
# ops.node(tag,*coords)
print(tag, end=" ")
print("\n15 newtag list:")
# if it exceeds 11(252 is already used), it will start from 253
for tag in Node.get_new_tags(15):
# ops.node(tag,*coords)
print(tag, end=" ")
# you can also put a large number before it(but your code should be more robust)
print("\n10 newtag list:")
for tag in Node.get_new_tags(10,start = 5000):
# ops.node(tag,*coords)
print(tag, end=" ")
5 newtag list:
242 243 244 245 246
15 newtag list:
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
10 newtag list:
5000 5001 5002 5003 5004 5005 5006 5007 5008 5009
[8]:
# similarliy, we have these property & method for Elementements and materials and so on
Element = Command.ELEMENT.instance
print(Element.newtag)
print(Element.newtag_upper)
print(Element.get_new_tags(5))
Material = Command.MATERIAL.instance
print(Material.newtag)
print(Material.newtag_upper)
print(Material.get_new_tags(5))
440
440
[440, 441, 442, 443, 444]
5
602
[5, 6, 7, 8, 9]