Skip to content

Commit

Permalink
Tool to delete Arrowheads Types - Bazooka Style (pyrevitlabs#1556)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcouffin authored and Andrea Ghensi committed Jan 20, 2023
1 parent d14d364 commit b9525b4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title:
fr_fr: Supprimer les têtes de flèches de manière radicale
en_us: Delete ArrowHeads type - Bazzoka style
tooltip:
fr_fr: Supprimer les têtes de flèches de manière radicale
en_us: Delete ArrowHeads type - Bazzoka style
highlight: new
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
from pyrevit import revit, script, DB, forms

doc = revit.doc

# takes care of closing previous output windows
output = script.get_output()
output.close_others()

arrowhead_types, arrowhead_types_names, deleted, not_deleted = [], [], '',''

# collect arrowhead types
element_types = DB.FilteredElementCollector(doc).OfClass(DB.ElementType).WhereElementIsElementType()

for element_type in element_types:
# check if element type is arrowhead
if element_type.get_Parameter(DB.BuiltInParameter.ARROW_CLOSED) and element_type.get_Parameter(DB.BuiltInParameter.SYMBOL_NAME_PARAM).AsString()!='':
# collect arrowhead types and arrowhead types names separately
arrowhead_types_names.append(element_type.get_Parameter(DB.BuiltInParameter.SYMBOL_NAME_PARAM).AsString())
arrowhead_types.append(element_type)

# The selection form
selection = forms.SelectFromList.show(arrowhead_types_names, 'Select arrowhead types you wand to delete', multiselect = True, infopanel = 'Select arrowhead type you wish to delete')

# checking if there is a selection
if selection:
with revit.Transaction('Delete Arrowheads'):
# get arrowhead_type from arrowhead_types_names selected
for e_name, e_type in zip(arrowhead_types_names, arrowhead_types):
if e_name in selection:
try:
# delete arrowhead_type
doc.Delete(e_type.Id)
deleted = deleted + '- ' + e_name + '\n'
except:
# not deleted - BECASUE YOU CANNOT DELETE ALL OF THEM
not_deleted = not_deleted + '- ' + e_name + '\n'
# show results
output.set_width(200)
output.print_md('#Deleted arrowheads: \n{}\n'.format(deleted))
output.print_md('#Not deleted arrowheads: \n{}\n'.format(not_deleted))
else:
script.exit()
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ layout:
- Wipe SubCategories
- Wipe Unused Filters
- Wipe Unused View Templates
- Wipe Empty Elevation Tags
- Wipe Empty Elevation Tags
- Wipe Arrowheads Types

0 comments on commit b9525b4

Please sign in to comment.