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


Python DB.FilteredElementCollector方法代码示例

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


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

示例1: fregion_id_by_name

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def fregion_id_by_name(name=None):
    """Get Id of Filled Region Type by Name.
    Loops through all types, tries to match name.
    If name not supplied, first type is used.
    If name supplied does not match, last type is used
    """
    f_region_types = FilteredElementCollector(doc).OfClass(FilledRegionType)
    for fregion_type in f_region_types:
        fregion_name = Element.Name.GetValue(fregion_type)
        if not name or name.lower() == fregion_name.lower():
            return fregion_type.Id
    # Loops through all, not found: use last
    else:
        logger.debug('Color not specified or not found.')
        return fregion_type.Id


# @revit_transaction('Create Text') - Transaction Already Started on Chart 
开发者ID:gtalarico,项目名称:pyrevitplus,代码行数:20,代码来源:utils.py

示例2: count_import_instances

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_import_instances(link_type):
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.ImportInstance).ToElements()
    counter = 0
    counter_linked = 0
    counter_imported = 0
    for item in collector:
        if item.IsLinked:
            counter_linked += 1
        if not item.IsLinked:
            counter_imported += 1
    if link_type == "linked":
        counter = counter_linked
    elif link_type == "imported":
        counter = counter_imported
    elif link_type == "all":
        counter = counter_linked + counter_imported
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:19,代码来源:rps_qc_model.py

示例3: count_view_filters_usage

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_view_filters_usage(usage_filter):
    filter_count = Fec(doc).OfClass(Autodesk.Revit.DB.FilterElement).ToElements().Count
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.View).ToElements()
    used_filters = set()
    counter = 0
    for view in collector:
        if not view.IsTemplate:
            if not view.ViewType.ToString() == "Schedule":
                try:
                    view_filters = view.GetFilters()
                    for view_filter in view_filters:
                        used_filters.add(doc.GetElement(view_filter).Name)
                except:
                    pass

    if usage_filter == "used":
        counter = len(usage_filter)
    elif usage_filter == "unused":
        counter = filter_count - len(used_filters)
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:22,代码来源:rps_qc_model.py

示例4: create_drafting_view

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def create_drafting_view(name=None):
    """Create a Drafting View"""
    def get_drafting_type_id():
        """Selects First available ViewType that Matches Drafting Type."""
        viewfamily_types = FilteredElementCollector(doc).OfClass(ViewFamilyType)
        for i in viewfamily_types:
            if i.ViewFamily == ViewFamily.Drafting:
                return i.Id

    drafting_type_id = get_drafting_type_id()
    drafting_view = ViewDrafting.Create(doc, drafting_type_id)
    if name is not None:
        drafting_view.Name = name
    return drafting_view 
开发者ID:gtalarico,项目名称:pyrevitplus,代码行数:16,代码来源:utils.py

示例5: count_views

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_views(view_type):
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.View).ToElements()
    counter = 0
    for view in collector:
        if not view.IsTemplate:
            if view.ViewType.ToString() == view_type:
                counter += 1
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:10,代码来源:rps_qc_model.py

示例6: count_templateless_plan_views

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_templateless_plan_views():
    plan_view_types = ["AreaPlan", "CeilingPlan", "Detail",
                       "DraftingView", "Elevation", "FloorPlan", "Section"]
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.View).ToElements()
    counter = 0
    for view in collector:
        if not view.IsTemplate:
            if view.ViewType.ToString() in plan_view_types:
                if view.ViewTemplateId.IntegerValue == -1:
                    counter += 1
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:13,代码来源:rps_qc_model.py

示例7: count_fonts

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_fonts():
    fonts = set()
    collector = Fec(doc).OfCategory(BuiltInCategory.OST_TextNotes).WhereElementIsNotElementType().ToElements()
    for txt in collector:
        fonts.add(txt.Symbol.LookupParameter("Text Font").AsString())
    return str(len(fonts)) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:8,代码来源:rps_qc_model.py

示例8: count_non_project_dwg_links

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_non_project_dwg_links(filter_paths):
    counter = 0
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.ImportInstance).ToElements()
    for inst in collector:
        if inst.IsLinked:
            inst_path = ModelPathUtils.ConvertModelPathToUserVisiblePath(doc.GetElement(inst.GetTypeId()).GetExternalFileReference().GetAbsolutePath())
            for img_path in filter_paths:
                if img_path in inst_path:
                    counter += 1
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:12,代码来源:rps_qc_model.py

示例9: get_unplaced_groups

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def get_unplaced_groups():
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.GroupType).ToElements()
    counter = 0
    for group in collector:
        instances = group.Groups
        if instances.IsEmpty == 1:
            counter += 1
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:10,代码来源:rps_qc_model.py

示例10: count_raster_images

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_raster_images(filtered, filter_paths):
    collector = Fec(doc).OfClass(Autodesk.Revit.DB.ImageType).ToElements()
    if filtered == "all":
        return str(collector.Count)
    if filtered == "non-project":
        counter = 0
        for img in collector:
            for img_path in filter_paths:
                if img_path in img.Path:
                    counter += 1
        return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:13,代码来源:rps_qc_model.py

示例11: all_detail_items

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def all_detail_items():
    collector = Fec(doc).OfCategory(BuiltInCategory.OST_DetailComponents).WhereElementIsNotElementType().ToElements()
    counter = 0
    for item in collector:
        if item.Name != "Detail Filled Region":
            counter += 1
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:9,代码来源:rps_qc_model.py

示例12: count_rooms

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_rooms(filtered):
    collector = Fec(doc).OfCategory(BuiltInCategory.OST_Rooms).WhereElementIsNotElementType().ToElements()
    counter = 0
    if filtered == "all":
        return str(collector.Count)
    elif filtered == "0sqm":
        for room in collector:
            if room.Area < 0.1:
                counter += 1
        return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:12,代码来源:rps_qc_model.py

示例13: count_line_styles_usage

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_line_styles_usage(usage_filter):
    counter = 0
    collector = Fec(doc).OfCategory(BuiltInCategory.OST_Lines).WhereElementIsNotElementType().ToElements()
    doc_styles = int(count_line_styles())
    used_line_styles = set()
    for line in collector:
        used_line_styles.add(line.LineStyle.Name)
    if usage_filter == "used":
        counter = len(used_line_styles)
    elif usage_filter == "unused":
        counter = doc_styles - len(used_line_styles)
    return str(counter) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:14,代码来源:rps_qc_model.py

示例14: count_category_elements

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_category_elements(category):
    collector = Fec(doc).OfCategory(category).WhereElementIsNotElementType().ToElements()
    return str(collector.Count) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:5,代码来源:rps_qc_model.py

示例15: count_class_elements

# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import FilteredElementCollector [as 别名]
def count_class_elements(cls):
    collector = Fec(doc).OfClass(cls).WhereElementIsNotElementType().ToElements()
    return str(collector.Count) 
开发者ID:hdm-dt-fb,项目名称:rvt_model_services,代码行数:5,代码来源:rps_qc_model.py


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