compat
python engine compatibility module.
Examples:
Attributes
PY2 = sys.version_info[0] == 2
module-attribute
PY3 = sys.version_info[0] == 3
module-attribute
IRONPY = '.net' in sys.version.lower()
module-attribute
IRONPY2 = PY2 and IRONPY
module-attribute
IRONPY3 = PY3 and IRONPY
module-attribute
NETCORE = System.Environment.Version.Major >= 8
module-attribute
NETFRAMEWORK = not NETCORE
module-attribute
NO_REVIT = -1
module-attribute
REVIT_NETCORE_VERSION = 2025
module-attribute
safe_strtype = str
module-attribute
Functions
get_elementid_value_func()
Returns the ElementId value extraction function based on the Revit version.
Follows API changes in Revit 2024.
Returns:
Name | Type | Description |
---|---|---|
function |
A function returns the value of an ElementId. |
Examples:
get_elementid_value = get_elementid_value_func()
sheet_revids = {get_elementid_value(x) for x in self.revit_sheet.GetAllRevisionIds()}
add_sheet_revids = {get_elementid_value(x) x in self.revit_sheet.GetAdditionalRevisionIds()}
Source code in pyrevitlib/pyrevit/compat.py
urlopen(url)
make_request(url, headers, data)
Urlopen wrapper to create and send a request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
request url |
required |
headers |
dict[str, str]
|
headers |
required |
data |
bytes | None
|
request data |
required |