Skip to content

Commit 784d563

Browse files
committed
print statements cleanup
1 parent e9b7298 commit 784d563

File tree

1 file changed

+22
-40
lines changed
  • extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton

1 file changed

+22
-40
lines changed

extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack/Analyse.pulldown/Door Mirror State.pushbutton/script.py

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,11 @@ def parameter_exists(parameter_name):
4040

4141
if not parameter_exists(DOORDIR_WRITEBACK_PARAM):
4242
print(
43-
"The parameter '{}' does not exist in the current document.".format(
44-
DOORDIR_WRITEBACK_PARAM
45-
)
43+
"The parameter '{}' does not exist in the current document.\n"
44+
"Please create the parameter as an instance parameter, option different values for groupes,\n"
45+
"for the category doors in the project.".format(DOORDIR_WRITEBACK_PARAM)
4646
)
47-
print(
48-
"Please create the parameter as an instance parameter, option different values for groupes,"
49-
)
50-
print("for the category doors in the project.")
51-
52-
sys.exit()
47+
script.exit()
5348

5449
count_parameter = 0
5550
count_not_parameter = 0
@@ -95,46 +90,34 @@ def parameter_exists(parameter_name):
9590
)
9691
door_out_param.Set(str(value))
9792
except AttributeError:
98-
print(
93+
forms.alert(
9994
"Please make sure instance parameter exists: {}".format(
10095
DOORDIR_WRITEBACK_PARAM
10196
)
10297
)
98+
script.exit()
10399

104100
output.print_md(
105-
"### Number of doors found in the project: {} ".format(len(doors_collector))
106-
)
107-
output.print_md(
108-
"of these with writeback parameters defined in door family: {}".format(
109-
count_parameter
110-
)
111-
)
112-
output.print_md(
113-
"without writeback parameters defined in door family: {a}".format(
114-
a=count_not_parameter,
101+
"### Number of doors found in the project: {} \n"
102+
"- With writeback parameters defined in door family: {}\n"
103+
"- Without writeback parameters defined in door family: {}\n"
104+
"- Parameters missing: '{}', '{}'\n"
105+
"- You will find in the folder of the script a shared parameter file containing these parameters.\n"
106+
"- The default writeback value for doors without defined values will be: '{}'\n"
107+
"---\n".format(
108+
len(doors_collector),
109+
count_parameter,
110+
count_not_parameter,
111+
DOORDIR_STANDARD_PARAM,
112+
DOORDIR_MIRRORED_PARAM,
113+
DOORDIR_ERROR_VALUE,
115114
)
116115
)
117-
output.print_md(
118-
"parameters missing: "
119-
"'{b}'"
120-
", "
121-
"'{c}'"
122-
"".format(b=DOORDIR_STANDARD_PARAM, c=DOORDIR_MIRRORED_PARAM)
123-
)
124-
output.print_md(
125-
"you will find in the folder of the script a shared parameter file containing this parameters."
126-
)
127-
output.print_md(
128-
"The default writeback value for doors without defined values will be : "
129-
" {d} "
130-
" ".format(d=DOORDIR_ERROR_VALUE)
131-
)
132-
output.print_md("---")
116+
133117
output.print_md("### Door families without writeback parameter defined in family:")
134118
for door_type in doors_without_parameter:
135119
print(door_type)
136-
output.print_md("---")
137-
output.print_md("### Changes to previous run of the script:")
120+
output.print_md("---\n### Changes to previous run of the script:")
138121

139122
if data_doors_changed:
140123
output.print_table(
@@ -145,6 +128,5 @@ def parameter_exists(parameter_name):
145128
else:
146129
output.print_md("#### No doors with changed parameters were found.")
147130

148-
output.print_md("---")
149131
elapsed_time = time.time() - timer_start
150-
output.print_md("#### Script has finished in {:.2f}s".format(elapsed_time))
132+
output.print_md("---\n#### Script has finished in {:.2f}s".format(elapsed_time))

0 commit comments

Comments
 (0)