Skip to content

Commit 6af4838

Browse files
Copilotjmcouffin
andcommitted
Fix ColorSplasher UnboundLocalError for 'version' variable
Co-authored-by: jmcouffin <7872003+jmcouffin@users.noreply.github.com>
1 parent d63fd59 commit 6af4838

File tree

1 file changed

+2
-1
lines changed
  • extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/ColorSplasher.pushbutton

1 file changed

+2
-1
lines changed

extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/ColorSplasher.pushbutton/script.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ def Execute(self, uiapp):
166166

167167
with revit.Transaction("Apply colors to elements"):
168168
get_elementid_value = get_elementid_value_func()
169+
version = int(HOST_APP.version)
169170
if get_elementid_value(sel_cat.cat.Id) in (
170171
int(DB.BuiltInCategory.OST_Rooms),
171172
int(DB.BuiltInCategory.OST_MEPSpaces),
172173
int(DB.BuiltInCategory.OST_Areas),
173174
):
174175
# In case of rooms, spaces and areas. Check Color scheme is applied and if not
175-
version = int(HOST_APP.version)
176176
if version > 2021:
177177
if wndw.crt_view.GetColorFillSchemeId(sel_cat.cat.Id).ToString() == "-1":
178178
color_schemes = (
@@ -586,6 +586,7 @@ def Execute(self, uiapp):
586586
categories = List[DB.ElementId]()
587587
categories.Add(sel_cat.cat.Id)
588588
solid_fill_id = solid_fill_pattern_id()
589+
version = int(HOST_APP.version)
589590
items_listbox = wndw.list_box2.Items
590591
for i, element in enumerate(items_listbox):
591592
item = wndw.list_box2.Items[i]["Value"]

0 commit comments

Comments
 (0)