本文整理汇总了Python中pyNastran.bdf.bdf.BDF.process_card方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.process_card方法的具体用法?Python BDF.process_card怎么用?Python BDF.process_card使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.bdf.BDF
的用法示例。
在下文中一共展示了BDF.process_card方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cord2c_01
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.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)
card = CORD2C(card)
model.add_coord(card)
lines = [
'CORD2R 4 3 10. 0. 5. 10. 90. 5.',
' 10. 0. 6.'
]
card = model.process_card(lines)
card = BDFCard(card)
card = CORD2R(card)
model.add_coord(card)
model.cross_reference()
cord2r = model.Coord(3)
self.assertEqual(cord2r.Cid(), 3)
self.assertEqual(cord2r.Rid(), 0)
cord2r = model.Coord(4)
self.assertEqual(cord2r.Cid(), 4)
self.assertEqual(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_1
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_cord2r_1(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 = 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)
#print(g.Position(debug=False))
# by running it through Patran...
#GRID 20143 1.1067 .207647 -.068531
diff = g.Position() - array([1.106704, .207647, -0.068531])
msg = 'diff=%s' % diff
assert allclose(diff, 0.), msg
coord = model.Coord(7)
coord.T()
self.assertTrue(array_equal(coord.T(), coord.beta_n(2)))
示例3: test_cord2r_02
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.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 = model.process_card(grid)
model.add_card(card, card[0])
card = model.process_card(coord)
model.add_card(card, card[0])
model.cross_reference()
coord = model.Coord(7)
#print(coord.origin)
#print(coord.i, coord.j, coord.k)
g = model.Node(20143)
#print(g.Position(debug=False))
xyz = g.Position()
# 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.beta_n(1)
coord.beta_n(2)
coord.beta_n(3)
coord.beta_n(6)
self.assertTrue(array_equal(coord.T(), coord.beta_n(2)))
示例4: test_cpenta_01
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_cpenta_01(self):
"""tests a cpenta15"""
lines = [
'CPENTA,85,22,201,202,203,205,206,207,+PN2',
'+PN2,209,210,217, , , ,213,214,',
',218'
]
bdf = BDF(debug=False)
card = bdf.process_card(lines)
card = BDFCard(card)
solid = CPENTA15.add_card(card, comment='cpenta15')
solid.write_card(size=8, is_double=False)
solid.write_card(size=16, is_double=False)
solid.raw_fields()
node_ids = solid.node_ids
assert node_ids == [201, 202, 203, 205, 206, 207,
209, 210, 217, None, None, None, 213, 214, 218], node_ids
nids = [201, 202, 203, 205, 206, 207,
209, 210, 217, None, None, None, 213, 214, 218]
CPENTA.add_card(card, comment='spike')
eid = 85
pid = 22
bdf.add_cpenta(eid, pid, nids, comment='spike')
示例5: test_pbeam_03
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_pbeam_03(self):
bdf = BDF(debug=False)
lines = [
'PBEAM,39,6,2.9,3.5,5.97',
' , , ,2.0,-4.0',
' ,YES,1.0,5.3,56.2,78.6',
' , , ,2.5,-5.0',
' , , ,1.1, ,2.1,,0.21',
' , , , , ,0.5,,0.0',
]
card = bdf.process_card(lines)
cardi = BDFCard(card)
card2 = PBEAM.add_card(cardi)
fields = card2.raw_fields()
lines_expected = [
'PBEAM 39 6 2.9 3.5 5.97 0. 0. 0.',
' 0. 0. 2. -4. 0. 0. 0. 0.',
' YES 1. 5.3 56.2 78.6 0. 0. 0.',
' 0. 0. 2.5 -5. 0. 0. 0. 0.',
' 1. 1. 1.1 0. 2.1 2.1 .21 .21',
' 0. 0. 0. 0. .5 .5 0. 0.',
]
self._compare(fields, lines_expected)
示例6: test_cord2_rcs_01
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_cord2_rcs_01(self):
"""
all points are located at <30,40,50>
"""
model = BDF(debug=False)
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.cross_reference()
for nid in model.nodes:
a = array([30.,40.,50.])
b = model.Node(nid).Position()
self.assertTrue(allclose(array([30.,40.,50.]), model.Node(nid).Position()), str(a-b))
示例7: test_dmig_06
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_dmig_06(self):
lines = ['DMIG ENFORCE 0 1 1 0']
model = BDF(debug=False)
card = model.process_card(lines)
card = BDFCard(card)
size = 8
card = DMIG(card)
card.write_card(size, 'dummy')
示例8: test_dmi_01
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_dmi_01(self):
"""tests a DMI card"""
lines = ['DMI,Q,0,6,1,0,,4,4']
model = BDF(debug=False)
card = model.process_card(lines)
card_obj = BDFCard(card)
size = 8
dmi = DMI.add_card(card_obj)
dmi.write_card(size, 'dummy')
示例9: test_pbeam_07
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_pbeam_07(self):
bdf = BDF(debug=False)
lines = [
'PBEAM 100 100 1.00 10. 1.0 +Z1',
'+Z1 NO 1.0 +Z4',
'+Z4 0.0 0.0',
]
card = bdf.process_card(lines)
cardi = BDFCard(card)
card2 = PBEAM.add_card(cardi)
示例10: test_set1_01
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_set1_01(self):
bdf = BDF(debug=False)
lines = ['SET1, 1100, 100, 101']
card = bdf.process_card(lines)
card = BDFCard(card)
size = 8
card = SET1.add_card(card)
card.write_card(size, 'dummy')
card.raw_fields()
card2 = SET1(1100, [100, 101], is_skin=False, comment='')
card2.write_card(size, 'dummy')
示例11: test_cord2_rcs_03
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_cord2_rcs_03(self):
"""
all points are located at <30,40,50>
"""
model = BDF(debug=False)
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.cross_reference()
for nid in model.nodes:
a = array([30.0, 40.0, 50.0])
b = model.Node(nid).get_position()
self.assertTrue(allclose(array([30.0, 40.0, 50.0]), model.Node(nid).get_position()), str(a - b))
示例12: test_cord2_rcs_02
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_cord2_rcs_02(self):
"""
all points are located at <30,40,50>
"""
model = BDF(debug=False)
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.cross_reference()
for nid in model.nodes:
a = array([30.0, 40.0, 50.0])
b = model.Node(nid).get_position()
self.assertTrue(allclose(array([30.0, 40.0, 50.0]), model.Node(nid).get_position()), str(a - b))
示例13: test_pbeam_08
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_pbeam_08(self):
bdf = BDF(debug=False)
lines = [
'PBEAM* 4570049 4570010 .12 2.56-4 * HRY',
'* HRY.005625 8.889-4 6.4444-7 * HRZ',
'* HRZ-.04 -.75 .04 -.75 * HSA',
'* HSA.04 .75 -.04 .75 * HSB',
'* HSB YES 1. .12 2.56-4 * HSC',
'* HSC.005625 8.889-4 6.4444-7 * HSD',
'* HSD-.04 -.75 .04 -.75 * HSE',
'* HSE.04 .75 -.04 .75 * HSF',
'* HSF.853433 .849842 * HSG',
'* HSG',
]
lines_expected = [
'PBEAM* 4570049 4570010 .12 .000256',
'* .005625 .0008889 .00000064444',
'* -.04 -.75 .04 -.75',
'* .04 .75 -.04 .75',
'* YES 1. .12 .000256',
'* .005625 .0008889 .00000064444',
'* -.04 -.75 .04 -.75',
'* .04 .75 -.04 .75',
'* .853433 .849842',
'*',
]
card = bdf.process_card(lines)
cardi = BDFCard(card)
card2 = PBEAM.add_card(cardi)
fields = card2.raw_fields()
msg = print_card_8(fields)
size = 16
msg = card2.write_card(size, 'dummy')
lines_actual = msg.rstrip().split('\n')
msg_a = '\n%s\n\n%s' % ('\n'.join(lines_expected), msg)
msg_a += 'nlines_actual=%i nlines_expected=%i' % (
len(lines_actual), len(lines_expected))
self.assertEqual(len(lines_actual), len(lines_expected), msg)
for actual, expected in zip(lines_actual, lines_expected):
actual = str(actual)
expected = str(expected)
msg = msg_a + '\nactual = %r\n' % actual
msg += 'expected = %r' % expected
self.assertEqual(actual, expected, msg)
示例14: test_pbeam_05
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_pbeam_05(self):
bdf = BDF(debug=False)
lines = [
'PBEAM,39,6,2.9,3.5,5.97',
' , , ,2.0,-4.0',
]
card = bdf.process_card(lines)
#print(print_card_8(card))
cardi = BDFCard(card)
card2 = PBEAM.add_card(cardi)
fields = card2.raw_fields()
msg = print_card_8(fields)
lines_expected = [
'PBEAM 39 6 2.9 3.5 5.97 0. 0. 0.',
' 0. 0. 2. -4. 0. 0. 0. 0.',
' 1. 1. 0. 0. 0. 0. 0. 0.',
' 0. 0. 0. 0. 0. 0. 0. 0.',
]
self._compare(fields, lines_expected)
示例15: test_pbeam_09
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import process_card [as 别名]
def test_pbeam_09(self):
bdf = BDF(debug=False)
fields = [
u'PBEAM', 4570049, 4570010, 0.12, 0.000256, 0.005625, None, 0.0008889, 6.4444e-07,
-0.04, -0.75, 0.04, -0.75, 0.04, 0.75, -0.04, 0.75,
'YES', 1.0, 0.12, 0.000256, 0.005625, 0.000256, None, 0.0008889,
6.4444e-07, -0.04, -0.75, 0.04, -0.75, 0.04, 0.75, -0.04,
0.853433, 0.849842
]
#fields = [u'PBAR', 1510998, 1520998, 0.0, 4.9000000000000006e-14,
#4.9000000000000006e-14, 0.0, 0.0, None, 0.0, 0.0, 0.0, 0.0,
#0.0, 0.0, 0.0, 0.0, None, None, 0.0]
card = print_card_8(fields)
#print(card)
card = print_card_8(fields)
lines = card.split('\n')
card = bdf.process_card(lines)
cardi = BDFCard(card)
#with self.assertRaises(AssertionError): # A=0, I12=0, K1=0
pbeam = PBEAM.add_card(cardi)
fields2 = pbeam.repr_fields()
assert fields == fields