Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.Common.Objects package

Subpackages

Submodules

duHast.Revit.Common.Objects.FailureHandlingConfiguration module

An implementation of Failur Handling Configuration

Defines how to process warnings in Revit by storing the configuration for the failure handling.: - Rolling back on warnings - Printing warnings - Rolling back on errors - Printing errors - Setting forced modal handling ( refer to autodesk documentation for more information ) - Setting clear after rollback ( refer to autodesk documentation for more information )

An output function is also provided to allow for custom output handling.

An instance of this class is passed to the failure handling function to determine how to handle failures.

class duHast.Revit.Common.Objects.FailureHandlingConfiguration.FailureHandlingConfig(roll_back_on_warning=False, print_warnings=False, roll_back_on_error=False, print_errors=False, set_forced_modal_handling=True, set_clear_after_rollback=True, output_function=<function output>, **kwargs)

Bases: Base

Constructor for the FailureHandlingConfig class.

Parameters:
  • roll_back_on_warning (bool) – Roll back the transaction on warnings.

  • print_warnings (bool) – Print warnings.

  • roll_back_on_error (bool) – Roll back the transaction on errors.

  • print_errors (bool) – Print errors.

  • set_forced_modal_handling (bool) – Set forced modal handling. ( refer to autodesk documentation for more information )

  • set_clear_after_rollback (bool) – Set clear after rollback. ( refer to autodesk documentation for more information )

  • output_function (function) – A function to handle output.

  • kwargs – Additional keyword arguments.

duHast.Revit.Common.Objects.FailuresPreProcessor module

An implementation of the Revit IFailuresProcessor interface

Helps to pre process warnings in Revit.

class duHast.Revit.Common.Objects.FailuresPreProcessor.FailuresPreprocessor(*args: Any, **kwargs: Any)

Bases: IFailuresPreprocessor

Constructor for the FailuresPreprocessor class.

Parameters:
PreprocessFailures(failures_accessor)

duHast.Revit.Common.Objects.ParameterDirectiveBase module

A parameter directive base class

Parameter directives are used to modify parameters of elements in a Revit model. This class is the base class for all parameter directives.

class duHast.Revit.Common.Objects.ParameterDirectiveBase.ParameterDirectiveBase(target_parameter_name='', parameter_modifier=None, parameter_value=None, j=None, **kwargs)

Bases: Base

Base class for all parameter directives.

Constructor for the ParameterDirective class.

Parameters:
  • target_parameter_name (str) – The name of the parameter to be modified.

  • parameter_modifier (A function accepting the value as an argument and returning the modified value.) – The modifier to be applied to the parameter value.

  • parameter_value (any) – The value to be applied to the parameter.

  • j (json) – A json object containing the properties of the class.

  • kwargs (dict) – Additional keyword arguments.

Raises:

ValueError – If the target_parameter_name or parameter_value is not supplied in j.

data_type = 'parameter_directive_base'
to_json()

Convert the instance of this class to json. Ignores parameter modifier property

Returns:

A Json object.

Return type:

json

duHast.Revit.Common.Objects.ParameterMappingDirective module

A parameter mapping class

Parameter mappings are used to transfer parameter values from one parameter to another. This class is used to define

  • source parameter name

  • source parameter is instance

  • target parameter name

  • parameter value

  • parameter modifier ( of the parameter value retrieved from source parameter)

  • parameter getter ( a function that returns the value of the source parameter)

class duHast.Revit.Common.Objects.ParameterMappingDirective.ParameterMappingDirective(target_parameter_name='', source_parameter_name='', parameter_modifier=None, parameter_value=None, source_parameter_is_instance=True, parameter_getter=None, j=None, **kwargs)

Bases: ParameterDirectiveBase

Class for parameter mapping directives.

Constructor for the ParameterMappingDirective class.

Parameters:
  • target_parameter_name (str) – The name of the parameter to be modified.

  • source_parameter_name (str) – The name of the parameter to be used as the source.

  • parameter_modifier (A function accepting the value as an argument and returning the modified value.) – The modifier to be applied to the parameter value.

  • parameter_value (any) – The value to be applied to the parameter.

  • source_parameter_is_instance (bool) – Indicates if the source parameter is an instance parameter.

  • parameter_getter (A function that returns the value of the source parameter.) – A function that returns the value of the source parameter.

  • j (json) – A json object containing the properties of the class.

  • kwargs (dict) – Additional keyword arguments.

Raises:

ValueError – If the source_parameter_name or source_parameter_is_instance is not supplied in j.

data_type = 'parameter_mapping_directive'
to_json()

Convert the instance of this class to json. Ignores parameter modifier and parameter getter class properties

Returns:

A Json object.

Return type:

json

duHast.Revit.Common.Objects.design_set_property_names module

Design set property names enum class.

class duHast.Revit.Common.Objects.design_set_property_names.DesignSetPropertyNames

Bases: object

Contains property names used in data set dictionary

DESIGN_SET_NAME = 'designSetName'
DESIGN_OPTION_NAME = 'designOptionName'
DESIGN_OPTION_IS_PRIMARY = 'isPrimary'
DESIGN_SET_DEFAULT_NAME = 'Main Model'
DESIGN_OPTION_DEFAULT_NAME = '-'
classmethod combine_set_and_option_name(set_name, option_name)

Combines the set and option name is fixed format

Parameters:
  • set_name (str) – The option set name

  • option_name (str) – The option name

Returns:

Combination of set and option name

Return type:

str

Module contents