You can easily print emojis to the output window using the :emoji-shorthand:
convention. To see all the shorthand options, launch the Emoji tool under pyRevit slideout.
Use the codes printed on the output for each emoji. For example the code below prints 👌
print(':OK_hand:')
Emojis are a feature of the output window so they are supported from any language or script that prints to the output window
Console.WriteLine(":OK_hand:");
The link maker from the output object, can be used to create clickable links on the output window. See documentation here.
from pyrevit import script
output = script.get_output()
# assuming element is an instance of DB.Element
print(output.linkify(element.Id))
The table maker from the output object, can be used to create tables on the output window. See documentation here.
from pyrevit import script
output = script.get_output()
table_data = [[1234.0, "Cell data aaa", "12.00", "41"],
[123456.00, "Cell data bbb", "12.20", "01"],
[123.0, "Cell data ccc", "22.02", "12"],
[5.001, "Cell data ddd", "11.00", "44"],
["123456", "-", "22.45", "41"]]
"""Print provided data in a HTML table in output window.
The same window can output several tables, each with their own formatting options.
Args:
table_data (list[iterable[Any]]): 2D array of data
title (str): table title, output as ###mark-down before the table
columns (list[str]): list of column names
formats (list[str]): column data formats using python string formatting
last_line_style (str): css style of last row of data (NB applies to all tables in this output)
column_head_align_styles (list[str]): list css align-text styles for header row
column_data_align_styles (list[str]): list css align-text styles for data rows
column_widths (list[str]): list of CSS widths in either px or %
column_vertical_border_style (str): CSS compact border definition
table_width_style (str): CSS to use for width for the whole table, in either px or %
repeat_head_as_foot (bool): Repeat the header row at the table foot (useful for long tables)
row_striping (bool): False to override the default white-grey row stripes and make all white)
"""
output.print_table(table_data=data,
title="Example table with formatting options",
columns=["NUMBERS", "STRINGS", "DECIMALS", "PERCENTAGE"],
formats=['{:.5}', '{}', '', '{}%'],
last_line_style='color:red; font-weight:bold'
column_head_align_styles=["center", "left", "right", "center"],
column_data_align_styles=["right", "left", "right", "center"],
column_widths = ["115px", "auto", "auto", "auto"],
column_vertical_border_style="border:black solid 1px",
repeat_head_as_foot=True if len(table_data)>14 else False # Automatic option by table length,
table_width_style="100%",
row_striping=True)
)
Call the print_table method with a 2D list of data.
The length of the first row of data is used in validation: all rows of data must be of the same length.