本文整理汇总了Python中pyNastran.bdf.dev_vectorized.bdf.BDF.get_elements方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.get_elements方法的具体用法?Python BDF.get_elements怎么用?Python BDF.get_elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.dev_vectorized.bdf.BDF
的用法示例。
在下文中一共展示了BDF.get_elements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bad_01
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import get_elements [as 别名]
def test_bad_01(self):
model = BDF(debug=False, log=None)
bdfname = os.path.join(testpath, 'test_mass.dat')
model.read_bdf(bdfname, include_dir=None, xref=True)
# this passes silently
print(model.elements[['cat']])
# this does not
with self.assertRaises(TypeError):
print(model.elements[None])
#print(model.get_elements('cat'))
with self.assertRaises(KeyError):
model.get_elements('cat')
示例2: test_mass_solid_1
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import get_elements [as 别名]
def test_mass_solid_1(self): # passes
model = BDF(debug=False, log=None)
bdfname = os.path.join(testpath, 'test_mass.dat')
model.read_bdf(bdfname, include_dir=None, xref=True)
# hexa - psolid - nsm = 0
#print(model.elements[7:8])
#print(model.elements[[7,8]])
model.elements[7:9]
model.elements[7:9:2]
model.elements[1:100]
#hexa = model.get_elements(7)
#hexa = model.get_elements(7)
#print(hexa)
hexa = model.elements[7]
mass = 0.2
volume = 2. # l * w * h = 1 * 1 * 2
rho = 0.1
E = 1.0
G = 2.0
nu = 3.0
centroid = array([0.5, 0.5, 1.0])
self.verify_psolid_element(hexa, mass, volume, centroid, rho, E, G, nu)
# tetra - psolid
tetra = model.get_elements(8)
mass = 1/30.
volume = 1/3. # 1/3 * b * h = 1/3 * 0.5 * 2.0
rho = 0.1
E = 1.0
G = 2.0
nu = 3.0
centroid = array([0.5, 0.25, 0.5])
self.verify_psolid_element(tetra[0], mass, volume, centroid, rho, E, G, nu)
# penta - psolid
penta = model.get_elements(9)
mass = 0.1
volume = 1.0 # b * h = 0.5 * 2
rho = 0.1
E = 1.0
G = 2.0
nu = 3.0
centroid = array([2/3., 1/3., 1.])
self.verify_psolid_element(penta[0], mass, volume, centroid, rho, E, G, nu)