query
Helper functions to query info and elements from Revit.
Attributes
mlogger = logger.get_logger(__name__)
module-attribute
GRAPHICAL_VIEWTYPES = [DB.ViewType.FloorPlan, DB.ViewType.CeilingPlan, DB.ViewType.Elevation, DB.ViewType.ThreeD, DB.ViewType.Schedule, DB.ViewType.DrawingSheet, DB.ViewType.Report, DB.ViewType.DraftingView, DB.ViewType.Legend, DB.ViewType.EngineeringPlan, DB.ViewType.AreaPlan, DB.ViewType.Section, DB.ViewType.Detail, DB.ViewType.CostReport, DB.ViewType.LoadsReport, DB.ViewType.PresureLossReport, DB.ViewType.ColumnSchedule, DB.ViewType.PanelSchedule, DB.ViewType.Walkthrough, DB.ViewType.Rendering]
module-attribute
DETAIL_CURVES = (DB.DetailLine, DB.DetailArc, DB.DetailEllipse, DB.DetailNurbSpline)
module-attribute
MODEL_CURVES = (DB.ModelLine, DB.ModelArc, DB.ModelEllipse, DB.ModelNurbSpline)
module-attribute
BUILTINCATEGORIES_VIEW = [DB.BuiltInCategory.OST_Views, DB.BuiltInCategory.OST_ReferenceViewer, DB.BuiltInCategory.OST_Viewers]
module-attribute
GridPoint = namedtuple('GridPoint', ['point', 'grids'])
module-attribute
SheetRefInfo = namedtuple('SheetRefInfo', ['sheet_num', 'sheet_name', 'detail_num', 'ref_viewid'])
module-attribute
ElementHistory = namedtuple('ElementHistory', ['creator', 'owner', 'last_changed_by'])
module-attribute
Classes
Functions
get_name(element, title_on_sheet=False)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_type(element)
Get element type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Element
|
source element |
required |
Returns:
Type | Description |
---|---|
ElementType
|
type object of given element |
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_symbol_name(element)
get_family_name(element)
get_episodeid(element)
get_guid(element)
Extract guid from given element.
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_param(element, param_name, default=None)
get_mark(element)
get_location(element)
Get element location point.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Element
|
source element |
required |
Returns:
Type | Description |
---|---|
XYZ
|
X, Y, Z of location point element |
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_biparam_stringequals_filter(bip_paramvalue_dict)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_elements(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_elements_in_view(view)
get_param_value(targetparam)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_value_range(param_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_elements_by_parameter(param_name, param_value, doc=None, partial=False)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_elements_by_param_value(param_name, param_value, inverse=False, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_elements_by_categories(element_bicats, elements=None, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_elements_by_class(element_class, elements=None, doc=None, view_id=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_types_by_class(type_class, types=None, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_family(family_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_family_symbol(family_name, symbol_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_families(doc=None, only_editable=True)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_noteblock_families(doc=None)
get_elements_by_family(family_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_elements_by_familytype(family_name, symbol_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
find_workset(workset_name_or_list, doc=None, partial=True)
Source code in pyrevitlib/pyrevit/revit/db/query.py
model_has_family(family_name, doc=None)
model_has_workset(workset_name, partial=False, doc=None)
get_sharedparam_definition_file()
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_defined_sharedparams()
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_project_parameters(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_project_parameter_id(param_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_project_parameter(param_id_or_name, doc=None)
model_has_parameter(param_id_or_name, doc=None)
get_global_parameters(doc=None)
get_global_parameter(param_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_project_info(doc=None)
get_revisions(doc=None)
get_sheet_revisions(sheet)
get_current_sheet_revision(sheet)
get_sheets(include_placeholders=True, include_noappear=True, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_links(linktype=None, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_linked_models(doc=None, loaded_only=False)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_linked_model_doc(linked_model)
Source code in pyrevitlib/pyrevit/revit/db/query.py
find_first_legend(doc=None)
compare_revisions(src_rev, dest_rev, case_sensitive=False)
get_all_views(doc=None, view_types=None, include_nongraphical=False)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_view_templates(doc=None, view_types=None)
get_sheet_by_number(sheet_num, doc=None)
get_viewport_by_number(sheet_num, detail_num, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_view_by_sheetref(sheet_num, detail_num, doc=None)
is_schedule(view)
Check if given DB.View is a Revit Schedule.
Returns False if given view is a DB.ViewSchedule but is a Schedule View Template, or Titleblock Revision Schedule, or Internal Keynote Schedule, or Keynote Legend Schedule
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_schedules(doc=None)
get_view_by_name(view_name, view_types=None, doc=None)
get_all_referencing_elements(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_referencing_elements_in_view(view)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_schedules_on_sheet(viewsheet, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
is_sheet_empty(viewsheet)
get_doc_categories(doc=None, include_subcats=True)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_schedule_categories(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_key_schedule_categories(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_takeoff_categories(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_category(cat_name_or_builtin, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_builtincategory(cat_name_or_id, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_subcategories(doc=None, purgable=False, filterfunc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_subcategory(cat_name_or_builtin, subcategory_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_builtinparameter(element, param_name, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_view_cutplane_offset(view)
get_project_location_transform(doc=None)
get_all_linkedmodels(doc=None)
get_all_linkeddocs(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_grids(group_by_direction=False, include_linked_models=False, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_gridpoints(grids=None, include_linked_models=False, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_closest_gridpoint(element, gridpoints)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_category_set(category_list, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_category_set(bindable=True, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_rule_filters(doc=None)
get_connected_circuits(element, spare=False, space=False)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_element_categories(elements)
get_category_schedules(category_or_catname, doc=None)
get_schedule_field(schedule, field_name)
get_schedule_filters(schedule, field_name, return_index=False)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_sheet_tblocks(src_sheet)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_sheet_sets(doc=None)
get_rev_number(revision, sheet=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_pointclouds(doc=None)
get_mep_connections(element)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_fillpattern_element(fillpattern_name, fillpattern_target, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_fillpattern_elements(fillpattern_target, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_fillpattern_from_element(element, background=True, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_local_keynote_file(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_external_keynote_file(doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_keynote_file(doc=None)
get_used_keynotes(doc=None)
get_visible_keynotes(view=None)
get_available_keynotes(doc=None)
get_available_keynotes_tree(doc=None)
is_placed(spatial_element)
get_central_path(doc=None)
is_metric(doc=None)
is_imperial(doc=None)
get_view_sheetrefinfo(view)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_sheeted_views(doc=None, sheets=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
is_view_sheeted(view)
can_refer_other_views(source_view)
is_referring_to(source_view, target_view)
Source code in pyrevitlib/pyrevit/revit/db/query.py
yield_referring_views(target_view, all_views=None)
yield_referenced_views(doc=None, all_views=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
yield_unreferenced_views(doc=None, all_views=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_line_categories(doc=None)
get_line_styles(doc=None)
get_history(target_element)
Source code in pyrevitlib/pyrevit/revit/db/query.py
is_detail_curve(element)
is_model_curve(element)
is_sketch_curve(element)
get_all_schemas()
get_schema_field_values(element, schema)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_family_type(type_name, family_doc)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_family_parameter(param_name, family_doc)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_family_parameters(family_doc)
get_family_label_parameters(family_doc)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_door_rooms(door)
Get from/to rooms associated with given door element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
door |
FamilyInstance
|
door instance |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
(Room, Room)
|
from/to rooms |
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_doors(elements=None, doc=None, room_id=None)
Get all doors in active or given document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elements |
list[Element]
|
find rooms in given elements instead |
None
|
doc |
Document
|
target document; default is active document |
None
|
room_id |
ElementId
|
only doors associated with given room |
None
|
Returns:
Type | Description |
---|---|
list[Element]
|
room instances |
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_all_print_settings(doc=None)
get_used_paper_sizes(doc=None)
find_paper_size_by_name(paper_size_name, doc=None)
find_paper_sizes_by_dims(printer_name, paper_width, paper_height, doc=None)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_titleblock_print_settings(tblock, printer_name, doc_psettings)
Source code in pyrevitlib/pyrevit/revit/db/query.py
get_crop_region(view)
Takes crop region of a view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
view |
View
|
view to get crop region from |
required |
Returns:
Type | Description |
---|---|
list[CurveLoop]
|
list of curve loops |