pyrevit.revit

class pyrevit.revit.ErrorSwallower(log_errors=True)

Suppresses warnings during script execution

Example

>>> with ErrorSwallower() as swallower:
>>>     for fam in families:
>>>         revit.doc.EditFamily(fam)
>>>         if swallower.get_swallowed():
>>>             logger.warn("Warnings swallowed")
get_swallowed_errors()

Return swallowed errors

on_failure_processing(_, event_args)

Failure processing event handler

reset()

Reset swallowed errors

class pyrevit.revit.RevitWrapper
static close_doc(doc)

Close given document.

Parameters:doc (DB.Document) – document
static open_doc(doc_path)

Open document at given path.

Parameters:doc_path (str) – document file path
Returns:opened document
Return type:DB.Document
static post_command(command_id)

Request Revit to run a command

Parameters:command_id (str) – command identifier e.g. ID_REVIT_SAVE_AS_TEMPLATE