本文整理汇总了Python中pyNastran.bdf.dev_vectorized.bdf.BDF.process_card方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.process_card方法的具体用法?Python BDF.process_card怎么用?Python BDF.process_card使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.dev_vectorized.bdf.BDF
的用法示例。
在下文中一共展示了BDF.process_card方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cord2c_01
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cord2c_01(self):
lines = [
'CORD2C* 3 0 0. 0.',
'* 0. 0. 0. 1.*',
'* 1. 0. 1.'
]
model = BDF(debug=False)
card = model.process_card(lines)
card = BDFCard(card)
model.coords.add_cord2c(card)
lines = [
'CORD2R 4 3 10. 0. 5. 10. 90. 5.',
' 10. 0. 6.'
]
card = model.process_card(lines)
card = BDFCard(card)
model.coords.add_cord2r(card)
model.cross_reference()
cord2r = model.Coord(3)
self.assertEquals(cord2r.Cid(), 3)
self.assertEquals(cord2r.Rid(), 0)
cord2r = model.Coord(4)
self.assertEquals(cord2r.Cid(), 4)
self.assertEquals(cord2r.Rid(), 3)
self.assertTrue(allclose(cord2r.i, array([0., 0., 1.])))
delta = cord2r.j - array([1., 1., 0.]) / 2**0.5
self.assertTrue(allclose(cord2r.j, array([1., 1., 0.]) / 2**0.5), str(delta))
delta = cord2r.k - array([-1., 1., 0.]) / 2**0.5
self.assertTrue(allclose(cord2r.k, array([-1., 1., 0.]) / 2**0.5), str(delta))
示例2: test_cord2r_02
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cord2r_02(self):
grid = ['GRID 20143 7 -9.31-4 .11841 .028296']
coord = ['CORD2R 7 1.135 .089237 -.0676 .135 .089237 -.0676',
' 1.135 .089237 .9324']
model = BDF(debug=False)
card_count = {
'GRID' : 1,
'CORD2R' : 1,
}
model.allocate(card_count)
card = model.process_card(grid)
model.add_card(card, card[0])
card = model.process_card(coord)
model.add_card(card, card[0])
model.cross_reference()
g = model.Node(20143)
#xyz = g.Position()
xyz = model.coords.get_global_position_by_node_id(20143, g.cp[0])[0]
# by running it through Patran...
#GRID 20143 1.1067 .207647 -.068531
expected = array([1.106704, .207647, -0.068531])
diff = xyz - expected
msg = '\nexpected=%s \nactual =%s \ndiff =%s' % (expected, xyz, diff)
assert allclose(diff, 0.), msg
coord = model.Coord(7)
coord.T()
self.assertTrue(array_equal(coord.T(), coord.beta_n(2)))
示例3: test_cord2_rcs_03
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cord2_rcs_03(self):
"""
all points are located at <30,40,50>
"""
model = BDF(debug=False)
card_count = {
'GRID' : 3,
'CORD2R' : 1,
'CORD2C' : 1,
'CORD2S' : 2,
}
model.allocate(card_count)
cards = [
[
'CORD2S* 2 0 0. 0.',
'* 0. 0. 0. 1.* ',
'* 1. 0. 1.',],
[
#'$ Femap with NX Nastran Coordinate System 30 : rectangular in spherical',
'CORD2R* 30 2 14. 30.',
'* 70. 13.431863852 32.1458443949 75.2107442927* ',
'* 14.4583462334 33.4569982885 68.2297989286',],
[
#'$ Femap with NX Nastran Coordinate System 31 : cylindrical in spherical',
'CORD2C* 31 2 3. 42.',
'* -173. 2.86526881213 45.5425615252 159.180363517* ',
'* 3.65222385965 29.2536614627 -178.631312271',],
[
#'$ Femap with NX Nastran Coordinate System 32 : spherical in spherical',
'CORD2S* 32 2 22. 14.',
'* 85. 22.1243073983 11.9537753718 77.9978191005* ',
'* 21.0997242967 13.1806120497 88.4824763008',],
[
'GRID* 30 30 40.7437952957 -23.6254877994',
'* -33.09784854 0',],
[
'GRID* 31 31 62.9378078196 15.9774797923',
'* 31.0484428362 0',],
[
'GRID* 32 32 53.8270847449 95.8215692632',
'* 159.097767463 0',],
]
for lines in cards:
card = model.process_card(lines)
model.add_card(card, card[0])
model.build()
for nid in model.nodes:
a = array([30., 40., 50.])
b = model.Node(nid).get_position()
self.assertTrue(allclose(array([30., 40., 50.]), model.Node(nid).get_position()), str(a - b))
示例4: test_cpenta_01
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cpenta_01(self):
model = BDF()
lines = ['CPENTA,85,22,201,202,203,205,206,207']
card = model.process_card(lines)
card = BDFCard(card)
size = 8
f = StringIO()
penta = CPENTA6(model)
penta.allocate(1)
penta.add(card)
penta.write_bdf(f, size)
#card.rawFields()
print(f.getvalue())
示例5: test_ctetra_01
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_ctetra_01(self):
model = BDF()
lines = ['CTETRA,85,22,201,202,203,205']
card = model.process_card(lines)
card = BDFCard(card)
size = 8
f = StringIO()
hexa = CTETRA4(model)
hexa.allocate(1)
hexa.add(card)
hexa.write_bdf(f, size)
#card.rawFields()
print(f.getvalue())
示例6: test_cord2_rcs_02
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cord2_rcs_02(self):
"""
all points are located at <30,40,50>
"""
model = BDF(debug=False)
card_count = {
'GRID' : 3,
'CORD2R' : 1,
'CORD2C' : 2,
'CORD2S' : 1,
}
model.allocate(card_count)
cards = [
[
'CORD2C* 1 0 0. 0.',
'* 0. 0. 0. 1.* ',
'* 1. 0. 1.',],
[
#'$ Femap with NX Nastran Coordinate System 20 : rectangular defined in cylindrical',
'CORD2R* 20 1 7. 20.',
'* -6. 7.07106781187 28.1301023542 -6.* ',
'* 7.70710678119 20. -5.29289321881',],
[
#'$ Femap with NX Nastran Coordinate System 21 : cylindrical defined in cylindrical',
'CORD2C* 21 1 15. -30.',
'* 12. 14.6565766735 -30.3177805524 12.9355733712* ',
'* 14.6234241583 -26.4257323272 11.9304419665',],
[
#'$ Femap with NX Nastran Coordinate System 22 : spherical defined in cylindrical',
'CORD2S* 22 1 5. -75.',
'* 20. 5.66032384035 -82.9319986389 19.8502545865* ',
'* 4.88876051026 -73.8006653677 19.0116094889',],
[
'GRID* 20 20 64.2559135157 -14.9400459772',
'* 27.3271005317 0',],
[
'GRID* 21 21 52.8328862418 -28.8729017195',
'* 34.615939507 0',],
[
'GRID* 22 22 61.1042111232 158.773483595',
'* -167.4951724 0',],
]
for lines in cards:
card = model.process_card(lines)
model.add_card(card, card[0])
model.build()
for nid in model.nodes:
a = array([30., 40., 50.])
b = model.Node(nid).get_position()
self.assertTrue(allclose(array([30., 40., 50.]), model.Node(nid).get_position()), str(a - b))
示例7: test_chexa_02
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_chexa_02(self):
model = BDF()
lines = ['CHEXA,85,22,201,202,203,205,206,207,+PN2',
'+PN2,209,210,217, , , ,213,214,218']
card = model.process_card(lines)
card = BDFCard(card)
size = 8
f = StringIO()
hexa = CHEXA20(model)
hexa.allocate(1)
hexa.add(card)
hexa.write_bdf(f, size)
#card.rawFields()
print(f.getvalue())
示例8: test_cpenta_02
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cpenta_02(self):
model = BDF()
lines = ['CPENTA,85,22,201,202,203,205,206,207,+PN2',
'+PN2,209,210,217, , , ,213,214,218']
card = model.process_card(lines)
card = BDFCard(card)
size = 8
f = StringIO()
penta = CPENTA15(model)
penta.allocate(1)
penta.add(card)
penta.write_card(f, size)
#card.rawFields()
print(f.getvalue())
示例9: test_cord2_rcs_01
# 需要导入模块: from pyNastran.bdf.dev_vectorized.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.dev_vectorized.bdf.BDF import process_card [as 别名]
def test_cord2_rcs_01(self):
"""
all points are located at <30,40,50>
"""
model = BDF(debug=False)
card_count = {
'GRID' : 3,
'CORD2R' : 1,
'CORD2C' : 1,
'CORD2S' : 1,
}
model.allocate(card_count)
cards = [
[
#'$ Femap with NX Nastran Coordinate System 10 : rectangular defined in a rectangular',
'CORD2R* 10 0 10. 5.',
'* 3. 10.3420201433 4.53015368961 3.81379768136* ',
'* 10.7198463104 5.68767171433 3.09449287122',],
[
#'$ Femap with NX Nastran Coordinate System 11 : cylindrical defined in rectangular',
'CORD2C* 11 0 7. 3.',
'* 9. 7.64278760969 2.73799736977 9.71984631039* ',
'* 7.75440650673 3.37968226211 8.46454486422',],
[
#'$ Femap with NX Nastran Coordinate System 12 : spherical defined in rectangular',
'CORD2S* 12 0 12. 8.',
'* 5. 12.6427876097 7.86697777844 5.75440650673* ',
'* 12.6634139482 8.58906867688 4.53861076379',],
[
'GRID* 10 10 42.9066011565 34.2422137135',
'* 28.6442730262 0',],
[
'GRID* 11 11 48.8014631871 78.8394787869',
'* 34.6037164304 0',],
[
'GRID* 12 12 58.0775343829 44.7276544324',
'* 75.7955331161 0',],
]
for lines in cards:
card = model.process_card(lines)
model.add_card(card, card[0])
model.build()
for nid in model.nodes:
a = array([30., 40., 50.])
b = model.Node(nid).get_position()
self.assertTrue(allclose(array([30., 40., 50.]), model.Node(nid).get_position()), str(a - b))