本文整理汇总了Python中pyNastran.bdf.fieldWriter.print_card_8函数的典型用法代码示例。如果您正苦于以下问题:Python print_card_8函数的具体用法?Python print_card_8怎么用?Python print_card_8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_card_8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cart3d_to_nastran_filename
def cart3d_to_nastran_filename(cart3d_filename, bdf_filename, log=None, debug=False):
"""
Converts a Cart3D file to STL format.
:param cart3d_filename: path to the input Cart3D file
:param bdf_filename: path to the output BDF file
:param log: a logger object (or None)
:param debug: True/False (used if log is not defined)
"""
cart3d = Cart3DReader(log=log, debug=debug)
(nodes, elements, regions, loads) = cart3d.read_cart3d(cart3d_filename)
#bdf = BDF()
#bdf.nodes = cart3d.nodes
#bdf.elements = cart3d.elements
#bdf.write_bdf(bdf_filename)
#return
f = open(bdf_filename, 'wb')
f.write('CEND\n')
f.write('BEGIN BULK\n')
f.write('$Nodes\n')
i = 0
nid = 1
cid = 0
for node in nodes:
card = print_card_16(['GRID', nid, cid] + list(node))
f.write(card)
eid = 1
f.write('$Elements\n')
for (n1, n2, n3), pid in zip(elements, regions):
card = print_card_8(['CTRIA3', eid, pid, n1, n2, n3])
f.write(card)
eid += 1
t = 0.1
E = 1e7
nu = 0.3
f.write('$Properties\n')
for pid in unique(regions):
mid = pid
card = print_card_8(['PSHELL', pid, mid, t])
f.write(card)
card = print_card_8(['MAT1', mid, E, None, nu])
f.write(card)
f.write('ENDDATA\n')
f.close()
示例2: write_bdf
def write_bdf(self, f, size=8):
card = ['SPCADD', self.spc_id] + self.spc_ids
#print "card = ", card
if size == 8:
f.write(print_card_8(card))
else:
f.write(print_card_16(card))
示例3: write_bdf
def write_bdf(self, f, size=8, is_double=False):
if self.n:
card = ['GRDSET', None, self.cp, None, None, None, self.cd, self.seid]
if size == 8:
f.write(print_card_8(card))
else:
f.write(print_card_16(card))
示例4: write_bdf
def write_bdf(self, f, size=8):
for comp, nodes in iteritems(self.components):
card = ['SPC1', self.constraint_id, comp] + list(nodes)
if size == 8:
f.write(print_card_8(card))
else:
f.write(print_card_16(card))
示例5: write_bdf
def write_bdf(self, f, size=8, is_double=False):
#..todo:: collapse the IDs
if self.n:
spoint = list(self.spoint)
spoint.sort()
card = ['SPOINT'] + collapse_thru(spoint)
f.write(print_card_8(card))
示例6: write_bdf
def write_bdf(self, size=8, is_double=False):
card = self.reprFields()
if size == 8:
return self.comment() + print_card_8(card)
elif is_double:
return self.comment() + print_card_double(card)
return self.comment() + print_card_16(card)
示例7: write_bdf
def write_bdf(self, f, size=8, property_id=None):
#print('PBARL.n = %s' % self.n)
if self.n:
if property_id is None:
i = arange(self.n)
else:
i = searchsorted(self.property_id, property_id)
#print('i = %s' % i)
#cid = [cid if cid != 0 else '' for cid in self.coord_id]
#group = set_blank_if_default(self.group, 'MSCBMLO')
#list_fields = ['PBARL', self.pid, self.Mid(), group, self.Type, None,
#None, None, None] + self.dim + [self.nsm]
#self.model.log.debug('*pbarl write pids=%s' % self.property_id)
for (j, pid, mid, group, Type, nsm) in zip(count(), self.property_id[i], self.material_id[i],
self.group[i], self.Type[i], self.nsm[i]):
dim = self.dim[j]
sgroup = set_blank_if_default(group, 'MSCBMLO')
list_fields = ['PBARL', pid, mid, group, Type, None,
None, None, None] + dim + [nsm]
if size == 8:
f.write(print_card_8(list_fields))
else:
f.write(print_card_16(list_fields))
示例8: write_bdf
def write_bdf(self, f, size=8, element_ids=None):
if self.n:
if element_ids is None:
i = arange(self.n)
else:
i = searchsorted(self.element_id, self.element_id)
offt = 0
ga = None
gb = None
x1 = None
x2 = None
x3 = None
for (eid, pid, n, pin, wa, wb) in zip(self.element_id[i], self.property_id[i], self.node_ids[i],
self.pin_flags[i], self.wa[i], self.wb[i]):
pa = set_blank_if_default(pin[0], 0)
pb = set_blank_if_default(pin[1], 0)
w1a = set_blank_if_default(wa[0], 0.0)
w2a = set_blank_if_default(wa[1], 0.0)
w3a = set_blank_if_default(wa[2], 0.0)
w1b = set_blank_if_default(wb[0], 0.0)
w2b = set_blank_if_default(wb[1], 0.0)
w3b = set_blank_if_default(wb[2], 0.0)
#(x1, x2, x3) = self.getX_G0_defaults()
#offt = set_blank_if_default(offt, 'GGG')
#list_fields = ['CBAR', self.eid, self.Pid(), self.Ga(), self.Gb(), x1, x2,
# x3, offt, pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt,
pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
f.write(print_card_8(card))
示例9: write_bdf
def write_bdf(self, f, size, is_double, coord_id=None):
assert size in [8, 16], size
assert is_double in [True, False], is_double
if self.n:
#if coord_id is None:
i = arange(self.n)
#else:
#assert len(unique(coord_id))==len(coord_id), unique(coord_id)
#i = searchsorted(self.coord_id, coord_id)
if size == 8:
for cid, coord in iteritems(self.coords):
if cid > 0:
list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
f.write(print_card_8(list_fields))
else:
if is_double:
for cid, coord in iteritems(self.coords):
if cid > 0:
list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
f.write(print_card_16(list_fields))
else:
for cid, coord in iteritems(self.coords):
if cid > 0:
list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
f.write(print_card_double(list_fields))
示例10: write_bdf
def write_bdf(self, f, size=8):
card = ['NLPCI', self.nlpci_id, self.Type, self.minalr,
self.maxalr, self.scale, None, self.desiter, self.mxinc]
if size == 8:
f.write(print_card_8(card))
else:
f.write(print_card_16(card))
示例11: write_bdf
def write_bdf(self, f, size=8, element_ids=None):
if self.n:
if element_ids is None:
i = arange(self.n)
else:
i = searchsorted(self.element_id, self.element_id)
for (eid, pid, n, is_g0, g0, x, is_offt, offt, bit, pin, wa, wb, sa, sb) in zip(
self.element_id[i], self.property_id[i], self.node_ids[i],
self.is_g0[i], self.g0[i], self.x[i],
self.is_offt[i], self.offt[i], self.bit[i],
self.pin_flags[i], self.wa[i], self.wb[i], self.sa[i], self.sb[i]):
x1 = g0 if is_g0 else x[0]
x2 = 0 if is_g0 else x[1]
x3 = 0 if is_g0 else x[2]
offt_bit = offt if is_offt else bit
#print('is_offt=%s offt=%s bit=%s offt_bit=%s' % (is_offt, offt, bit, offt_bit))
pa = set_blank_if_default(pin[0], 0)
pb = set_blank_if_default(pin[1], 0)
w1a = set_blank_if_default(wa[0], 0.0)
w2a = set_blank_if_default(wa[1], 0.0)
w3a = set_blank_if_default(wa[2], 0.0)
w1b = set_blank_if_default(wb[0], 0.0)
w2b = set_blank_if_default(wb[1], 0.0)
w3b = set_blank_if_default(wb[2], 0.0)
sa = set_blank_if_default(sa, 0)
sb = set_blank_if_default(sb, 0)
card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt_bit,
pa, pb, w1a, w2a, w3a, w1b, w2b, w3b,
sa, sb]
f.write(print_card_8(card))
示例12: write_bdf
def write_bdf(self, f, size=8, element_ids=None):
if self.n:
if element_ids is None:
i = arange(self.n)
else:
i = searchsorted(self.element_id, self.element_id)
for (eid, pid, n, is_g0, g0, x, offt, pin, wa, wb) in zip(
self.element_id[i], self.property_id[i], self.node_ids[i],
self.is_g0[i], self.g0[i], self.x[i],
self.offt[i],
self.pin_flags[i], self.wa[i], self.wb[i]):
pa = set_blank_if_default(pin[0], 0)
pb = set_blank_if_default(pin[1], 0)
w1a = set_blank_if_default(wa[0], 0.0)
w2a = set_blank_if_default(wa[1], 0.0)
w3a = set_blank_if_default(wa[2], 0.0)
w1b = set_blank_if_default(wb[0], 0.0)
w2b = set_blank_if_default(wb[1], 0.0)
w3b = set_blank_if_default(wb[2], 0.0)
x1 = g0 if is_g0 else x[0]
x2 = 0 if is_g0 else x[1]
x3 = 0 if is_g0 else x[2]
offt = set_string8_blank_if_default(offt, 'GGG')
card = ['CBAR', eid, pid, n[0], n[1], x1, x2, x3, offt,
pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
if size == 8:
f.write(print_card_8(card))
else:
f.write(print_card_16(card))
示例13: write_bdf
def write_bdf(self, f, size=8, property_id=None):
if self.n:
#print "PSOLID.property_id =", self.property_id
for (pid, mid, stress) in zip(
self.property_id, self.material_id, self.stress_strain):
stress_strain = set_blank_if_default(stress_strain, 'GRID')
card = ['PLSOLID', pid, mid, stress_strain]
f.write(print_card_8(card))
示例14: write_bdf
def write_bdf(self, f, size=8, is_double=False):
#..todo:: collapse the IDs
if self.n:
card = ['EPOINT'] + list(self.epoint)
if size == 8:
f.write(print_card_8(card))
else:
f.write(print_card_16(card))
示例15: test_print_card_8
def test_print_card_8(self):
self.assertEqual(print_card_8(['GRID',1]),'GRID 1\n')
self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
None, None, 1]),
'GRID 1\n 1\n',
print_card_8(['GRID', 1, None, None, None, None, None,
None, None, 1]))
self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
None, None,
1, None]),
'GRID 1\n 1\n',
print_card_8(['GRID', 1, None, None, None, None, None,
None, None,
1, None]))
self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
None, None,
None,None,None,None,None,None,None,None,
1, None]),
'GRID 1\n+\n 1\n',
print_card_8(['GRID', 1, None, None, None, None, None,
None, None,
None,None,None,None,None,None,None,None,
1, None]))