Skip to content

Commit 69ed0e0

Browse files
authored
Merge branch 'develop' into fix/2570
2 parents 904d146 + c9c240d commit 69ed0e0

File tree

6 files changed

+94
-2
lines changed
  • extensions/pyRevitTools.extension/pyRevit.tab
  • pyrevitlib/pyrevit/revit/db

6 files changed

+94
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
title:
2+
ru: Получить отверстия
3+
fr_fr: Obtenir les ouvertures
4+
en_us: Get Openings
5+
de_de: Öffnungen ermitteln
6+
tooltip: >
7+
en_us: |
8+
Scans through the project for openings. A list with clickable links will be presented. Open a 3D view to access and see the selected openings. A selection filter will be created or updated to select all openings with one click.
9+
de_de: |
10+
Durchsucht das Projekt nach Öffnungen. Eine Liste mit anklickbaren Links wird angezeigt. Öffnen Sie eine 3D-Ansicht, um auf die ausgewählten Öffnungen zuzugreifen und diese zu sehen. Es wird ein Auswahlfilter erstellt oder aktualisiert, um alle Öffnungen mit einem Klick auszuwählen.
11+
fr_fr: |
12+
Examine le projet à la recherche d'ouvertures. Une liste avec des liens cliquables sera présentée. Ouvrez une vue 3D pour accéder et voir les ouvertures sélectionnées. Un filtre de sélection sera créé ou mis à jour pour sélectionner toutes les ouvertures en un seul clic.
13+
authors: Jakob Steiner, inspired by the initial work of Andreas Draxl, Mohamed Bedair, special thanks to Erik Frits
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""Lists all openings in the project and creates
4+
a selection filter for them."""
5+
6+
# Sytem
7+
import time
8+
9+
# pyRevit
10+
from pyrevit import revit, script, DB
11+
from pyrevit.framework import List
12+
doc =__revit__.ActiveUIDocument.Document
13+
uidoc =__revit__.ActiveUIDocument
14+
output = script.get_output()
15+
selection = uidoc.Selection
16+
timer_start = time.time()
17+
18+
# GET ALL OPENINGS IN THE PROJECT
19+
20+
# List of categories
21+
cats = [DB.BuiltInCategory.OST_FloorOpening,
22+
DB.BuiltInCategory.OST_SWallRectOpening,
23+
DB.BuiltInCategory.OST_ShaftOpening,
24+
DB.BuiltInCategory.OST_RoofOpening]
25+
list_cats = List[DB.BuiltInCategory](cats)
26+
27+
# Create filter
28+
multi_cat_filter = DB.ElementMulticategoryFilter(list_cats)
29+
30+
# Apply filter to filteredElementCollector
31+
all_elements = DB.FilteredElementCollector(doc)\
32+
.WherePasses(multi_cat_filter)\
33+
.WhereElementIsNotElementType()\
34+
.ToElements()
35+
36+
# Get elements for selection filter
37+
element_ids = DB.FilteredElementCollector(doc).OfClass(DB.Opening).ToElementIds()
38+
element_ids = List[DB.ElementId](element_ids)
39+
40+
# Declaration of a list to contains list of wanted element properties
41+
data = []
42+
43+
# Collect information about the object and put it into in the data list.
44+
for e in all_elements:
45+
el = []
46+
el.append(e.Name)
47+
el.append(e.Id)
48+
# add IFC Classification if parameter exist
49+
e_link = output.linkify(e.Id)
50+
el.append(e_link)
51+
data.append(el)
52+
53+
# Get All Selection Filters
54+
all_sel_filters = DB.FilteredElementCollector(doc).OfClass(DB.SelectionFilterElement).ToElements()
55+
dict_sel_filters = {f.Name: f for f in all_sel_filters}
56+
57+
# Transaction to create a new selection filter
58+
with revit.Transaction('Create Openings Filter'):
59+
new_filter_name = '0_ShaftOpenings'
60+
if new_filter_name not in dict_sel_filters:
61+
new_fil = DB.SelectionFilterElement.Create(doc, new_filter_name)
62+
new_fil.AddSet(element_ids)
63+
print ('Created a filter called : {}'.format(new_filter_name))
64+
else:
65+
existing_fil = dict_sel_filters[new_filter_name]
66+
existing_fil.AddSet(element_ids)
67+
print ('Updated a filter called : {}'.format(new_filter_name))
68+
69+
# Report
70+
output.print_md("#### There are {} openings (floor, wall, shaft, roof) in the project.".format(len(all_elements))) # TO DO Output link for all.
71+
if data:
72+
output.print_table(table_data=data, title="Shafts:", columns=["Family" ,"ElementId", "Select/Show Element"])
73+
#output.print_md("#####Total {} WDB/WA elements has been updated.".format(len(data)))
74+
else:
75+
output.print_md("#####There are no openings (floor, wall, shaft, roof) in the project")
76+
77+
# End
78+
output.print_md('---')
79+
output.print_md('#### Script has finished in {}s'.format(time.time() - timer_start))

extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack/Select.pulldown/Find And Select Entities Without Tags.pushbutton/script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
untagged_elements = []
238238
for eltid in target_tags:
239239
elt = revit.doc.GetElement(eltid)
240-
elif HOST_APP.is_newer_than(2022, or_equal=True):
240+
if HOST_APP.is_newer_than(2022, or_equal=True):
241241
if elt.GetTaggedLocalElementIds() != DB.ElementId.InvalidElementId:
242242
tagged_elements.append(List[DB.ElementId](get_elementid_value(elt.GetTaggedLocalElementIds())[0]))
243243
else:

pyrevitlib/pyrevit/revit/db/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ def get_rvt_link_doc_name(rvtlink_instance):
11781178
Returns:
11791179
str: The name of the Revit link document, without the file extension and any directory paths.
11801180
"""
1181-
return get_name(rvtlink_instance).split(" \ ")[0].split(".rvt")[0]
1181+
return get_name(rvtlink_instance).split("\\")[0].split(".rvt")[0]
11821182

11831183

11841184
def get_rvt_link_instance_name(rvtlink_instance=None):

0 commit comments

Comments
 (0)