Skip to content

Commit aa1baf6

Browse files
authored
wrap editfamily in try except to catch non revit errors
1 parent 08378b5 commit aa1baf6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack/Inspect.pulldown/ListFamilySizeCreator.pushbutton/ListFamilySizeCreator_script.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,14 @@ def print_sorted(families, group_by):
150150
for fam in all_fams:
151151
with revit.ErrorSwallower() as swallower:
152152
if fam.IsEditable:
153-
fam_doc = revit.doc.EditFamily(fam)
153+
try:
154+
fam_doc = revit.doc.EditFamily(fam)
155+
except Exception as ex:
156+
logger.warning(
157+
"Skipping family '%s': could not open for edit: %s",
158+
fam_name, ex
159+
)
160+
continue
154161
fam_path = fam_doc.PathName
155162
# if the family path does not exists, save it temporary
156163
# only if the wasn't opened when the script was started

0 commit comments

Comments
 (0)