Sample Code Revit Batch Processor 1.1.14 documentation

Contents:

This Page

duHast.Data.Utils package

Submodules

duHast.Data.Utils.collectors_to_blueprints module

Utility functions converting collector objects to blueprint objects.

duHast.Data.Utils.collectors_to_blueprints.sheets_group_by_instance_property(sheet_data, property_name)

Groups sheets by a given property

Parameters:
  • sheet_data ([:class: .DataSheet]) – A list od DataSheet instances

  • property_name (str) – The name of the sheet instance property by its value to group the sheets by

Raises:
  • ValueError – property_name needs to be of type str

  • ValueError – sheet_data needs to be of type list

  • ValueError – sheet got multiple properties of the given name

  • ValueError – sheet no properties of the given name

  • ValueError – sheet_data list contained a none DataSheet object

Returns:

Result class instance.
  • .status True if sheets where grouped successfully, otherwise False.

  • .message will be empty.

  • . result (a list with the grouped sheets as a dictionary)

on exception:

  • .result Will be False

  • .message will contain exception message.

  • . result (empty list)

rtype:

Result

duHast.Data.Utils.data_export module

Utility functions exporting revit geometry to data objects.

duHast.Data.Utils.data_export.get_data_from_model(doc)

Gets element data from the model. This is currently limited to

  • rooms

  • ceilings

Parameters:

doc (Autodesk.Revit.DB.Document) – The current model document.

Returns:

A dictionary in format {file name: str, date processed : str, room:[], ceiling:[]}

Return type:

{}

duHast.Data.Utils.data_import module

Data storage reader class.

class duHast.Data.Utils.data_import.ReadDataFromFile(file_path)

Bases: object

Class to read data from a json formatted file and store it in data objects.

The class supports the following data types:

  • class:

    .DataRoom

  • class:

    .DataCeiling

Class constructor.

Parameters:

filePath (str) – Fully qualified file path to json formatted data file.

SUPPORTED_DATA_TYPES = {'ceiling': <class 'duHast.Data.Objects.Collectors.data_ceiling.DataCeiling'>, 'room': <class 'duHast.Data.Objects.Collectors.data_room.DataRoom'>}
add_debug_message_from_load(json)

Returns a list of debug messages from the load process.

Returns:

A list of debug messages.

Return type:

list

load_data()

Load json formatted rows into data objects and stores them in this class.

In the moment the following data objects are supported:

  • class:

    .DataRoom

  • class:

    .DataCeiling

get_data_by_level(level_name)

Returns all data objects where level name equals past in value.

Parameters:

level_name (str) – The building level name.

Returns:

A list of room and ceiling data objects

Return type:

list [data objects]

get_data_by_type(data_type)

Returns all data objects where type equals past in type name

Parameters:

data_type (str) – The data type name.

Returns:

A list of room and ceiling data objects

Return type:

list [data objects]

get_data_by_level_and_data_type(level_name, data_type)

Returns all data objects where level name and data type equal past in values.

Parameters:
  • level_name (str) – The building level name.

  • data_type (str) – A string describing the data type refer to property .dataType on data object class

Returns:

A list of data objects

Return type:

list [data objects]

duHast.Data.Utils.data_to_file module

Utility functions writing data objects to file.

duHast.Data.Utils.data_to_file.build_json_for_file(dic, model_name)

Adds two header keys to json output to be saved to file.

  • file name

  • date processed

Parameters:
  • dic ({str:[]}) – A dictionary containing all data items. Key is the data tpe, value the data objects

  • model_name (str) – The revit model name.

Returns:

A dictionary

Return type:

{str:[]}

Module contents