Im not sure if i am just doing something wrong or if this might be a bug, so i wanted to check here before i open a github issue.
When outputting a table using emojis in a “column” it seems to break the formatting, im not sure what is going on exactly, so ill just post some screenshots below.
Sure things. I probably should have done that initially.
# -*- coding: utf-8 -*-
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
from pyrevit import script
# Get the active document
doc = __revit__.ActiveUIDocument.Document
output = script.get_output()
# Define the tests to check. Allows sending list to output even if the list is empty
tests = ["Test 1", "Test 2"]
def check_element(element, output):
data = []
try:
if """Test Something""":
title = "Test 1"
datarow = [ ":emoji-shorthand:",output.linkify(element.Id), element.Name]
data.append((title, datarow))
except AttributeError:
pass
try:
if """Test Something""":
title = "Test 2"
datarow = [":emoji-shorthand:",output.linkify(element.Id), element.Name]
data.append((title, datarow))
except AttributeError:
pass
return data
# Initialize results with all tests
results = {test: [] for test in tests}
# Collect all elements once
all_elements = FilteredElementCollector(doc).WhereElementIsNotElementType().ToElements()
warningTable = []
# Perform all checks
for element in all_elements:
element_data = check_element(element, output)
for title, datarow in element_data:
results[title].append(datarow)
# Print results for each test
for test in tests:
datarows = results[test]
if not datarows: # If there are no failing elements for this test
datarows = [[":emoji-shorthand:","N/A", "No failing elements"]]
output.print_table(table_data=datarows,
title=test,
columns=["Check","ID", "Description"])
I assume you used :cross_mark: where you stated emoji-shorthand; if not, please provide the exact emoji and check if anything changes with other emojis.
If you still encounter the error, try to add a space after the shorthand: ":cross_mark: "
Thanks for taking the time to investigate this issue!
I didn’t test it on my setup yet, but to me it seems a bug worth opening an issue on github.
Cc @Jean-Marc to keep him posted: looking through the code I didn’t find anything obvious about this issue, but I discovered that emojis are png images in a zip file;
Since the output window is just a web browser control, we could set the css to use a monospaced font that supports emoji characters and drop the png embedding altogether. What do you think?
Another useful thing could be generate the tables directly in html as I proposet in another thread to minimise the conversion steps and related bugs