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


Python BDF.get_property_id_to_element_ids_map方法代码示例

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


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

示例1: example7

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import get_property_id_to_element_ids_map [as 别名]
def example7():
    """
    Example 7:  Get Elements by Material ID - Level 2
    """
    # this example will demonstate:
    #  - getting a list of elements that have a certain material

    # our model
    import pyNastran
    pkg_path = pyNastran.__path__[0]
    test_path = os.path.join(pkg_path, '..', 'models', 'sol_101_elements')
    bdf_filename = os.path.join(test_path, 'static_solid_shell_bar.bdf')

    # instantiate the model
    from pyNastran.bdf.bdf import BDF
    model = BDF()
    model.read_bdf(bdf_filename, xref=True)
    f = open('junk.out', 'w')

    # assume you want the eids for material 10
    pid_to_eids_map = model.get_property_id_to_element_ids_map()
    mid_to_pids_map = model.get_material_id_to_property_ids_map()

    pids1 = mid_to_pids_map[1]
    print('pids1 = %s' % pids1)
    ## pids1 = [1, 2, 3, 4, 5]
    eids = []
    for pid in pids1:
        eids += pid_to_eids_map[pid]

    # convert to elements instead of element IDs
    elements = []
    for eid in eids:
        element = model.Element(eid)
        elements.append(element)
        print(str(element).rstrip())
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:38,代码来源:bdf_doc.py

示例2: example6

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import get_property_id_to_element_ids_map [as 别名]
def example6():
    """
    Example 6:  Get Elements by Property ID - Level 2
    """
    # this example will demonstate:
    #  - getting a list of elements that have a certain property

    # our model
    import pyNastran
    pkg_path = pyNastran.__path__[0]
    test_path = os.path.join(pkg_path, '..', 'models', 'sol_101_elements')
    bdf_filename = os.path.join(test_path, 'static_solid_shell_bar.bdf')

    # instantiate the model
    from pyNastran.bdf.bdf import BDF
    model = BDF()
    model.read_bdf(bdf_filename, xref=True)
    f = open('junk.out', 'w')

    # Creating a List of Elements based on a Property ID

    # assume pid=1
    pid_to_eids_map = model.get_property_id_to_element_ids_map()
    eids4  = pid_to_eids_map[4] # PSHELL

    print("eids4 = %s" % eids4)
    ## eids4 = [6, 7, 8, 9, 10, 11]

    # convert to elements instead of element IDs
    elements4 = []
    for eid in eids4:
        elements4.append(model.Element(eid))

    # just to verify
    elem = model.elements[eids4[0]]
    print(elem.pid)
开发者ID:ClaesFredo,项目名称:pyNastran,代码行数:38,代码来源:bdf_doc.py


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