本文整理匯總了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
示例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)
示例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)
示例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
示例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)
示例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)
示例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))
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)