本文整理汇总了Python中pyNastran.bdf.bdf.BDF.pop_parse_errors方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.pop_parse_errors方法的具体用法?Python BDF.pop_parse_errors怎么用?Python BDF.pop_parse_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNastran.bdf.bdf.BDF
的用法示例。
在下文中一共展示了BDF.pop_parse_errors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cart3d_to_nastran_model
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import pop_parse_errors [as 别名]
def cart3d_to_nastran_model(cart3d_filename, log=None, debug=False):
"""
Converts a Cart3D file to Nastran format and returns a BDF() object.
Parameters
----------
cart3d_filename : str
path to the input Cart3D file
log : log / None
log : a logger object
None : a log will be defined
debug : bool
True/False (used if log is not defined)
Returns
-------
bdf_model : BDF
BDF() model object
"""
if isinstance(cart3d_filename, Cart3D):
cart3d = cart3d_filename
else:
cart3d = read_cart3d(cart3d_filename, log=log, debug=debug, result_names=None)
nodes = cart3d.nodes
elements = cart3d.elements
regions = cart3d.regions
if regions.min() == 0:
# bit of a hack to take an invalid cart3d model and make it
# work in Nastran, which requires property_ids > 0
regions += 1
i = 0
nid = 1
cid = 0
model = BDF(log=log, debug=debug)
for node in nodes:
card = ['GRID', nid, cid] + list(node)
model.add_card(card, 'GRID', is_list=True)
nid += 1
eid = 1
for (n1, n2, n3), pid in zip(elements, regions):
card = ['CTRIA3', eid, pid, n1, n2, n3]
model.add_card(card, 'CTRIA3', is_list=True)
#print(model.elements[eid])
eid += 1
t = 0.1
E = 1e7
nu = 0.3
for pid in unique(regions):
mid = pid
card = ['PSHELL', pid, mid, t]
model.add_card(card, 'PSHELL', is_list=True)
card = ['MAT1', mid, E, None, nu]
model.add_card(card, 'MAT1', is_list=True)
model.pop_parse_errors()
return model
示例2: cart3d_to_nastran_model
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import pop_parse_errors [as 别名]
def cart3d_to_nastran_model(cart3d_filename, log=None, debug=False):
"""
Converts a Cart3D file to Nastran format and returns a BDF() object.
Parameters
----------
cart3d_filename : str
path to the input Cart3D file
log : log / None
log : a logger object
None : a log will be defined
debug : bool
True/False (used if log is not defined)
Returns
-------
bdf_model : BDF
BDF() model object
"""
cart3d = Cart3D(log=log, debug=debug)
cart3d.read_cart3d(cart3d_filename)
nodes = cart3d.nodes
elements = cart3d.elements
regions = cart3d.regions
i = 0
nid = 1
cid = 0
model = BDF(log=log, debug=debug)
for node in nodes:
card = ['GRID', nid, cid] + list(node)
model.add_card(card, 'GRID', is_list=True)
nid += 1
eid = 1
for (n1, n2, n3), pid in zip(elements, regions):
card = ['CTRIA3', eid, pid, n1, n2, n3]
model.add_card(card, 'CTRIA3', is_list=True)
#print(model.elements[eid])
eid += 1
t = 0.1
E = 1e7
nu = 0.3
for pid in unique(regions):
mid = pid
card = ['PSHELL', pid, mid, t]
model.add_card(card, 'PSHELL', is_list=True)
card = ['MAT1', mid, E, None, nu]
model.add_card(card, 'MAT1', is_list=True)
model.pop_parse_errors()
return model
示例3: cart3d_to_nastran
# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import pop_parse_errors [as 别名]
def cart3d_to_nastran(cart3d_filename, log=None, debug=False):
"""
Converts a Cart3D file to Nastran format and returns a BDF() object.
:param cart3d_filename: path to the input Cart3D file
:param log: a logger object (or None)
:param debug: True/False (used if log is not defined)
:retval bdf_model: BDF() model object
"""
from pyNastran.bdf.bdf import BDF
cart3d = Cart3DReader(log=log, debug=debug)
(nodes, elements, regions, loads) = cart3d.read_cart3d(cart3d_filename)
i = 0
nid = 1
cid = 0
model = BDF(log=log, debug=debug)
for node in nodes:
card = ['GRID', nid, cid] + list(node)
model.add_card(card, 'GRID', is_list=True)
nid += 1
eid = 1
for (n1, n2, n3), pid in zip(elements, regions):
card = ['CTRIA3', eid, pid, n1, n2, n3]
model.add_card(card, 'CTRIA3', is_list=True)
#print(model.elements[eid])
eid += 1
t = 0.1
E = 1e7
nu = 0.3
for pid in unique(regions):
mid = pid
card = ['PSHELL', pid, mid, t]
model.add_card(card, 'PSHELL', is_list=True)
card = ['MAT1', mid, E, None, nu]
model.add_card(card, 'MAT1', is_list=True)
model.pop_parse_errors()
return model