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


Python BDF.disable_cards方法代码示例

本文整理汇总了Python中pyNastran.bdf.bdf.BDF.disable_cards方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.disable_cards方法的具体用法?Python BDF.disable_cards怎么用?Python BDF.disable_cards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNastran.bdf.bdf.BDF的用法示例。


在下文中一共展示了BDF.disable_cards方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_disable_cards

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import disable_cards [as 别名]
 def test_disable_cards(self):
     bdf_filename = os.path.join(root_path, '..', 'models',
         'solid_bending', 'solid_bending.bdf')
     model = BDF(debug=False)
     model.disable_cards(['CTETRA'])
     model.read_bdf(bdf_filename)
     assert len(model.elements) == 0, len(model.elements)
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:9,代码来源:test_read_write.py

示例2: bdf_merge

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import disable_cards [as 别名]
def bdf_merge(
    bdf_filenames,
    bdf_filename_out=None,
    renumber=True,
    encoding=None,
    size=8,
    is_double=False,
    cards_to_skip=None,
    log=None,
):
    """
    Merges multiple BDF into one file

    Parameters
    ----------
    bdf_filenames : List[str]
        list of bdf filenames
    bdf_filename_out : str / None
        the output bdf filename (default=None; None -> no writing)
    renumber : bool
        should the bdf be renumbered (default=True)
    encoding : str
        the unicode encoding (default=None; system default)
    size : int; {8, 16}; default=8
        the bdf write precision
    is_double : bool; default=False
        the field precision to write
    cards_to_skip : List[str]; (default=None -> don't skip any cards)
        There are edge cases (e.g. FLUTTER analysis) where things can break due to
        uncross-referenced cards.  You need to disable entire classes of cards in
        that case (e.g. all aero cards).

    Supports
    --------
      nodes:      GRID
      coords:     CORDx
      elements:   CQUAD4, CTRIA3, CTETRA, CPENTA, CHEXA, CELASx, CBAR, CBEAM
                  CONM1, CONM2, CMASS
      properties: PSHELL, PCOMP, PSOLID, PMASS
      materials:  MAT1, MAT8

    .. todo:: doesn't support SPOINTs/EPOINTs
    .. warning:: still very preliminary
    """
    if not isinstance(bdf_filenames, (list, tuple)):
        raise TypeError("bdf_filenames is not a list/tuple...%s" % str(bdf_filenames))

    if not len(bdf_filenames) > 1:
        raise RuntimeError("You can't merge one BDF...bdf_filenames=%s" % str(bdf_filenames))
    for bdf_filename in bdf_filenames:
        if not isinstance(bdf_filename, string_types):
            raise TypeError("bdf_filenames is not a string...%s" % bdf_filename)
        # bdf_filenames = [bdf_filenames]

    # starting_id_dict_default = {
    #'cid' : max(model.coords.keys()),
    #'nid' : max(model.nodes.keys()),
    #'eid' : max([
    # max(model.elements.keys()),
    # max(model.masses.keys()),
    # ]),
    #'pid' : max([
    # max(model.properties.keys()),
    # max(model.properties_mass.keys()),
    # ]),
    #'mid' : max(model.material_ids),
    # }
    model = BDF(debug=False, log=log)
    model.disable_cards(cards_to_skip)
    bdf_filename0 = bdf_filenames[0]
    model.read_bdf(bdf_filename0, encoding=encoding)
    model.log.info("primary=%s" % bdf_filename0)

    data_members = ["coords", "nodes", "elements", "masses", "properties", "properties_mass", "materials"]
    for bdf_filename in bdf_filenames[1:]:
        # model.log.info('model.masses = %s' % model.masses)
        starting_id_dict = {
            "cid": max(model.coords.keys()) + 1,
            "nid": max(model.nodes.keys()) + 1,
            "eid": max([max(model.elements.keys()), 0 if len(model.masses) == 0 else max(model.masses.keys())]) + 1,
            "pid": max(
                [
                    max(model.properties.keys()),
                    0 if len(model.properties_mass) == 0 else max(model.properties_mass.keys()),
                ]
            )
            + 1,
            "mid": max(model.material_ids) + 1,
        }
        # for param, val in sorted(iteritems(starting_id_dict)):
        # print('  %-3s %s' % (param, val))

        model.log.info("secondary=%s" % bdf_filename)
        model2 = BDF(debug=False)
        model2.disable_cards(cards_to_skip)
        bdf_dump = "bdf_merge_temp.bdf"
        # model2.read_bdf(bdf_filename, xref=False)

        bdf_renumber(
            bdf_filename,
#.........这里部分代码省略.........
开发者ID:hurlei,项目名称:pyNastran,代码行数:103,代码来源:bdf_merge.py

示例3: bdf_renumber

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import disable_cards [as 别名]

#.........这里部分代码省略.........
            tstepnl_id = int(value)
        elif key == 'suport_id':
            suport_id = int(value)
        elif key == 'suport1_id':
            suport1_id = int(value)
        elif key == 'tf_id':
            tf_id = int(value)
        else:
            raise NotImplementedError('key=%r' % key)

    # build the maps
    eid_map = {}
    nid_map = {}
    reverse_nid_map = {}
    mid_map = {}
    cid_map = {}
    mpc_map = {}
    spc_map = {}
    dload_map = {}
    load_map = {}

    cmethod_map = {}
    method_map = {}
    flfact_map = {}
    flutter_map = {}
    freq_map = {}
    tstep_map = {}
    tstepnl_map = {}
    suport_map = {}
    suport1_map = {}

    if isinstance(bdf_filename, string_types):
        model = BDF(debug=False)
        model.disable_cards(cards_to_skip)
        model.read_bdf(bdf_filename)
    else:
        model = bdf_filename

    if model.spoints is None:
        spoints = []
    else:
        spoints = list(model.spoints.points)
    if model.epoints is None:
        epoints = []
    else:
        epoints = list(model.epoints.points)

    nids = model.nodes.keys()
    from itertools import chain

    spoints_nids = sorted(chain(spoints, nids))
    #spoints_nids.sort()
    i = 1
    #nnodes = len(spoints_nids)

    i = 1
    #j = 1
    #print(spoints_nids)
    #k = 0
    #model.log.debug(starting_id_dict)
    if 'nid' in starting_id_dict and nid is not None:
        i = nid
        #banned_nodes = spoints
        for nidi in spoints_nids:
            if nidi in spoints:
                pass
开发者ID:hurlei,项目名称:pyNastran,代码行数:70,代码来源:bdf_renumber.py


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