Sample Code Revit Batch Processor 1.1.16 documentation
This module requires python >3.9 due to dependencies:
numpy
shapely
Gets the rotation/ translation matrix from the geometry object
geometry_object (DataGeometry) – A data geometry object instance.
A translation matrix.
numpy array
Returns the boundary loop of an object as list of shapely points.
Points are translated with passed in matrix. Any loops containing less then 3 points will be ignored. (Empty list will be returned)
geometry_object (DataGeometry) – A data geometry object instance.
translation_matrix (numpy array) – A translation matrix.
List of shapely points defining a polygon. (Empty list will be returned if less then 3 points in loop.)
List[shapely.point]
Returns the inner loops (holes) of an object as list of lists of shapely points.
Points are translated with passed in matrix. Any inner loops containing less then 3 points will be ignored. (Empty list will be returned)
geoObject (DataGeometry) – A data geometry object instance.
translationM (numpy array) – A translation matrix.
List of lists of shapely points defining a polygon.
list [list[shapely.point]]
Creates shapely polygon with nested polygons from list of shapely polygons past in.
Assumptions is: first polygon describes the boundary loop and any subsequent polygons are describing holes within the boundary
shapely_polygons (list[shapely.polygon]) – list of shapely polygons
A shapely polygon.
shapely.polygon
Returns a list of of shapely polygons from data instances past in.
Polygons may contain holes
data_instance (A class with .geometry property returning a DataGeometry instance.) – _description_
A list of shapely polygons.
list [shapely.polygon]
List of available geometry (from revit to shapely ) converters
Converts polygon points from DataGeometry instances to shapely polygon instances and returns them as a dictionary where:
key is the geometry objects id
value is a list of shapely polygons
geometry_objects (list[data object]) – A list of instances of the the same type (i.e DataRoom)
data_type (str) – string human readable identifying the data type ( each Data… class has this as a static field: dr.DataRoom.dataType)
A dictionary.
{int:[shapely.polygon]}
This module requires python >3.9 due to dependencies:
numpy
shapely
This module:
collects ceiling and room data instances by level ( assume a ceiling is always modelled as the room it is in )
converts room and ceiling outlines to shapely polygons
test for intersection of all ceilings on a given level with all rooms on a given level
stores any intersections found ( does a check how much area is intersecting…if to small its assumed its not an intended intersection)
reports all rooms and any associated ceiling(s) found
Writes Room data to file.
Note:
Room data consists of fixed (always reported) instance properties and custom instance properties defined in room_instance_property_keys
Ceiling data consists of fixed (always reported) instance properties, custom type properties defined in ceiling_type_property_keys and custom instance properties defined in ceiling_instance_property_keys
the report contains a row per associated element per room ( if 2 ceilings are in a room, the report will contain 2 rows)
data ({str:[:class: .DataRoom]}) – A dictionary where key is the level name and values is a list of DataRoom instances.
output_file_path (str) – Fully qualified file path to output report file.
room_instance_property_keys (list, optional) – Names of room instance properties to be reported, defaults to [‘Number’, ‘Name’]
ceiling_type_property_keys (list, optional) – Names of ceiling type properties to be reported, defaults to [‘Type Mark’]
ceiling_instance_property_keys (list, optional) – Names of ceiling instance properties to be reported, defaults to [‘Height Offset From Level’]
Result class instance.
Export status returned in result.status. False if an exception occurred, otherwise True.
result.message will contain the processing messages.
result.result will be an empty list
On exception:
result.status (bool) will be False.
result.message will contain the exception message.
Reads Revit data from file and runs an intersection check of each ceiling on a level with each room on the same level.
Note: DataRoom instance will contain any ceilings in that room in associated elements property.
data_source_path (str) – Fully qualified file path to json formatted file containing DataRoom and DataCeiling objects.
Result class instance.
result.status False if an exception occurred, otherwise True.
result.message will contain processing messages.
result.result A dictionary where key is the level name, value is a tuple of two lists: first one are rooms, second ones are ceiling data objects.
On exception:
result.status (bool) will be False.
result.message will contain the exception message.
result.result will be an empty list
This module requires python >3.9 due to dependencies:
numpy
shapely
This module:
collects floor and room data instances by level (assumes a floor is always modelled within the room it belongs to)
converts room and floor outlines to shapely polygons
tests for intersection of all floors on a given level with all rooms on a given level
stores any intersections found (checks how much area is intersecting; if too small it is assumed not an intended intersection)
reports all rooms and any associated floor(s) found
Writes room + associated floor data to a CSV file.
The report contains one row per associated floor per room.
data (dict{str: (list[DataRoom], list[DataFloor])}) – Dictionary keyed by level name, values are (rooms, floors) tuples.
output_file_path (str) – Fully qualified path for the output CSV file.
room_instance_property_keys (list[str], optional) – Room instance parameter names to report.
Defaults to ['Number', 'Name'].
floor_type_property_keys (list[str], optional) – Floor type parameter names to report.
Defaults to ['Type Mark'].
floor_instance_property_keys (list[str], optional) – Floor instance parameter names to report.
Defaults to ['Height Offset From Level'].
Result instance with status and messages.
Reads Revit data from file and runs an intersection check of each floor on a level with each room on the same level.
Any floor whose polygon overlaps a room by more than 0.1 % of the room area
is added to that room’s associated_elements list.
data_source_path (str) – Fully qualified path to a json file containing
DataRoom and DataFloor objects.
Result class instance.
result.status: False if an exception occurred, otherwise True.
result.message: processing messages.
result.result: dictionary keyed by level name, values are (rooms, floors) tuples with rooms populated with associated floors.
On exception:
result.status (bool) will be False.
result.message will contain the exception message.
result.result will be an empty list.
This module:
reads room and item data instances from a json file
matches each item to its room(s) using the room ids already stored on the item (populated during export via Revit’s phase-aware room lookup)
reports all rooms and any associated item(s) found
No shapely / numpy dependency — room membership is resolved by id, not by geometry.
Writes room + associated item data to a CSV file.
The report contains one row per associated item per room.
data (dict{str: (list[DataRoom], list[DataItem])}) – Dictionary keyed by level name, values are (rooms, items) tuples.
output_file_path (str) – Fully qualified path for the output CSV file.
room_instance_property_keys (list[str], optional) – Room instance parameter names to report.
Defaults to ['Number', 'Name'].
item_type_property_keys (list[str], optional) – Item type parameter names to report.
Defaults to ['Type Mark'].
item_instance_property_keys (list[str], optional) – Item instance parameter names to report.
Defaults to [].
Result instance with status and messages.
Reads Revit data from file and matches each item to the room(s) it belongs to using the room ids already stored on the item.
Any matched item is added to that room’s associated_elements list.
data_source_path (str) – Fully qualified path to a json file containing
DataRoom and DataItem objects.
Result class instance.
result.status: False if an exception occurred, otherwise True.
result.message: processing messages.
result.result: dictionary keyed by level name, values are (rooms, items) tuples with rooms populated with associated items.
On exception:
result.status (bool) will be False.
result.message will contain the exception message.
result.result will be an empty list.