revit
Revit application wrapper.
Attributes
mlogger = get_logger(__name__)
module-attribute
Classes
RevitWrapper()
Bases: ModuleType
Revit application wrapper.
Attributes
uidoc
property
Active UI Document.
doc
property
Active document.
docs
property
Active documents.
active_view
property
writable
Active view.
active_ui_view
property
Active UI view.
servers
property
Available revit server names.
Functions
open_doc(doc_path)
staticmethod
Open document at given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc_path |
str
|
document file path |
required |
Returns:
Type | Description |
---|---|
Document
|
opened document |
close_doc(doc)
staticmethod
post_command(command_id)
staticmethod
Request Revit to run a command.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command_id |
str
|
command identifier e.g. ID_REVIT_SAVE_AS_TEMPLATE |
required |
ErrorSwallower(log_errors=True)
Suppresses warnings during script execution.
Examples:
with ErrorSwallower() as swallower:
for fam in families:
revit.doc.EditFamily(fam)
if swallower.get_swallowed():
logger.warn("Warnings swallowed")
Source code in pyrevitlib/pyrevit/revit/__init__.py
Functions
on_failure_processing(_, event_args)
Failure processing event handler.
Source code in pyrevitlib/pyrevit/revit/__init__.py
get_swallowed_errors()
Functions
get_imported_symbol(symbol_name)
Geth an imported symbol by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
symbol_name |
str
|
symbol name |
required |
Returns:
Type | Description |
---|---|
Any
|
imported symbol, if found, None otherwise. |