When I use ColorSplasher the colors do not reset when I press that button. There are no pop-ups, nothing happens.
Revit 2024.2
PyRevit v4.8.16.24121
Thanks,
-Ian
When I use ColorSplasher the colors do not reset when I press that button. There are no pop-ups, nothing happens.
Revit 2024.2
PyRevit v4.8.16.24121
Thanks,
-Ian
I’ve the same problem, from my analysis there were few issues in ResetColors class. I also would have one suggestion to use selected category in (for not resetting objects that were not overwritten by Color Splasher)
collector = ( DB.FilteredElementCollector(new_doc, view.Id) .WhereElementIsNotElementType() .WhereElementIsViewIndependent() .ToElements() )
Here’s the ResetColors class with issues that blocked me from running reset button:
class ResetColors(UI.IExternalEventHandler):
def __init__(self):
pass
def Execute(self, uiapp):
try:
new_doc = revit.DOCS.doc
view = get_active_view(new_doc)
sel_cat = wndw._categories.SelectedItem['Value']
#Issue number 1
#Error: sel_par = wndw._listBox1.SelectedItem['Value']
#AttributeError: 'FormCats' object has no attribute '_listBox1'
#sel_par = wndw._listBox1.SelectedItem['Value']
try:
#Issue number 2
# Error: filter_name = sel_cat._name + "/"
# AttributeError: 'int' object has no attribute '_name'
filter_name = sel_cat._name + "/"
except Exception:
filter_name = ""
filters = view.GetFilters()
if len(filters) != 0:
with revit.Transaction(doc=new_doc, name="Reset colors in elements"):
for filt_id in filters:
filt_ele = new_doc.GetElement(filt_id)
if filt_ele.Name.StartsWith(filter_name):
view.RemoveFilter(filt_id)
try:
new_doc.Delete(filt_id)
except:
pass
if view != 0:
# unnecessary creation of OverrideGraphicSettings
#ogs = DB.OverrideGraphicSettings().Dispose()
ogs = DB.OverrideGraphicSettings()
collector = (
DB.FilteredElementCollector(new_doc, view.Id)
.WhereElementIsNotElementType()
.WhereElementIsViewIndependent()
.ToElements()
)
with revit.Transaction(doc=new_doc, name="Reset colors in elements"):
for ele in collector:
view.SetElementOverrides(ele.Id, ogs)
except Exception as e:
#print(traceback.format_exc())
pass
def GetName(self):
return "Reset colors in elements"
OK, issue number 2 was cased by not selecting category, it’s enough to comment this line:
Awesome, thanks for the help!
Latest WIP installers includes lots of fixes and new features for the tool
Nice one, @Jean-Marc!