Public demo snapshot of an in-house pyRevit extension for precast concrete shop-ticket QC (37 checks / 46 checklist rows) and a standalone panel handling solver (PCI Chapter 8). - No client, job, plant or product data: knowledge layers ship as structural templates only. - Ticket QC's model-read escalation targets a LAN model server endpoint (configurable), not a cloud provider. - Built from the private development repo via tools/make_dist.py.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The small Python 2 / Python 3 bridge.
|
||||
|
||||
We do not choose the interpreter -- pyRevit does, from the engine configured
|
||||
for the host. This extension was written on Revit 2025 with IronPython 2.7,
|
||||
but the same folder may be dropped on a machine whose pyRevit is set to
|
||||
IronPython 3 or CPython 3, where `unicode` and `basestring` are a NameError.
|
||||
|
||||
A NameError at module scope takes the whole button down with a traceback the
|
||||
user cannot act on, so the two names are resolved once, here.
|
||||
|
||||
Everything else in this extension is already written in the intersection of
|
||||
the two languages: no f-strings, no print statement, no implicit integer
|
||||
division, no pathlib. Keep it that way and the engine stops mattering.
|
||||
"""
|
||||
|
||||
try: # Python 2 (IronPython 2.7)
|
||||
text_type = unicode # noqa: F821
|
||||
string_types = (str, unicode) # noqa: F821
|
||||
except NameError: # Python 3 (IronPython 3, CPython 3)
|
||||
text_type = str
|
||||
string_types = (str,)
|
||||
|
||||
|
||||
def as_text(value, encoding='utf-8'):
|
||||
"""Return value as the interpreter's unicode text type."""
|
||||
if isinstance(value, text_type):
|
||||
return value
|
||||
if isinstance(value, bytes):
|
||||
return value.decode(encoding)
|
||||
return text_type(value)
|
||||
Reference in New Issue
Block a user