当前位置: 首页>>代码示例>>Python>>正文


Python BDF.pop_parse_errors方法代码示例

本文整理汇总了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
开发者ID:saullocastro,项目名称:pyNastran,代码行数:61,代码来源:cart3d_to_nastran.py

示例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
开发者ID:HibernantBear,项目名称:pyNastran,代码行数:54,代码来源:cart3d_to_nastran.py

示例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
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:41,代码来源:cart3d_to_nastran.py


注:本文中的pyNastran.bdf.bdf.BDF.pop_parse_errors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。