Skip to content

api

Provide access to Revit API.

Examples:

from pyrevit.api import AdWindows

Functions

get_product_serial_number()

Return serial number of running host instance.

Returns:

Type Description
str

Serial number

Source code in pyrevitlib/pyrevit/api.py
def get_product_serial_number():
    """Return serial number of running host instance.

    Returns:
        (str): Serial number
    """
    return UIFrameworkServices.InfoCenterService.ProductSerialNumber

is_product_demo()

Determine if product is using demo license.

Returns:

Type Description
bool

True if product is using demo license

Source code in pyrevitlib/pyrevit/api.py
def is_product_demo():
    """Determine if product is using demo license.

    Returns:
        (bool): True if product is using demo license
    """
    return get_product_serial_number() == '000-00000000'

is_api_object(data_type)

Check if given object belongs to Revit API.

Parameters:

Name Type Description Default
data_type object

Object to check

required

Returns:

Type Description
bool

True if object belongs to Revit API

Source code in pyrevitlib/pyrevit/api.py
def is_api_object(data_type):
    """Check if given object belongs to Revit API.

    Args:
        data_type (object): Object to check

    Returns:
        (bool): True if object belongs to Revit API
    """
    if hasattr(data_type, 'GetType'):
        return 'Autodesk.Revit.' in data_type.GetType().Namespace