Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Geometry package

Subpackages

Submodules

duHast.Geometry.bounding_box_2 module

A 2D bounding box base class.

class duHast.Geometry.bounding_box_2.BoundingBox2(point1=None, point2=None, j=None, **kwargs)

Bases: BoundingBoxBase

A 2D bounding box class.

Parameters:
  • point1 (Point2, optional) – A 3D point describing a corner of bounding box, defaults to None

  • point2 (Point2, optional) – A 3D point describing diagonal opposite corner of bounding box, defaults to None

  • j ([str], optional) – A json formatted string, representing an instance of this class, defaults to None

Raises:
  • ValueError – “Either two Point2 instances or a JSON string with point data needs to be provided.”

  • TypeError – “point1 expected Point2 instance. Got type instead.

  • TypeError – “point2 expected Point2 instance. Got type instead.”

update(point1, point2)

Update the size of the bounding box by points

Parameters:
  • point1 (Point2) – min point on bounding box

  • point2 (Point2) – max point of bounding box

Raises:
  • TypeError – _description_

  • TypeError – _description_

contains(point)

Check if the bounding box contains a given point.

width()

The length of the bounding box in X direction.

Returns:

float: Length in X

depth()

The length of the bounding box in Y direction.

Returns:

float: Length in Y

ratio()

The length ration of the bounding box edges by dividing length in X by length in Y direction

Raises:

ValueError: Division by 0 if length of Y is 0

Returns:

float: Edge ration

duHast.Geometry.bounding_box_3 module

A 3D bounding box base class.

class duHast.Geometry.bounding_box_3.BoundingBox3(point1=None, point2=None, j=None)

Bases: BoundingBoxBase

A 3D bounding box class.

Parameters:
  • point1 (Point3, optional) – A 3D point describing a corner of bounding box, defaults to None

  • point2 (Point3, optional) – A 3D point describing diagonal opposite corner of bounding box, defaults to None

  • j ([str], optional) – A json formatted string, representing an instance of this class, defaults to None

Raises:
  • ValueError – “Either two Point2 instances or a JSON string with point data needs to be provided.”

  • TypeError – “point1 expected Point3 instance. Got type instead.”

  • TypeError – “point2 expected Point3 instance. Got type instead.”

property min_z

Read-only property for minimum z value.

property max_z

Read-only property for maximum z value.

update(point1, point2)

Update the size of the bounding box by points

Parameters:
  • point1 (Point3) – min point on bounding box

  • point2 (Point3) – max point of bounding box

Raises:
  • TypeError – _description_

  • TypeError – _description_

contains(point)
width()

The length of the bounding box in X direction.

Returns:

float: Length in X

depth()

The length of the bounding box in Y direction.

Returns:

float: Length in Y

height()

The length of the bounding box in Z direction.

Returns:

float: Length in Z

duHast.Geometry.bounding_box_base module

A bounding box base class.

class duHast.Geometry.bounding_box_base.BoundingBoxBase(j=None, **kwargs)

Bases: Base

Base implementation of a bounding box.

Raises:
  • TypeError – “Input must be a JSON string or a dictionary.”

  • ValueError – “JSON must contain ‘point1’ and ‘point2’ keys.”

property json_ini

Read-only property to access the parsed JSON data.

property min_x

Read-only property for minimum x value.

property max_x

Read-only property for maximum x value.

property min_y

Read-only property for minimum y value.

property max_y

Read-only property for maximum y value.

contains(point)
width()
depth()
ratio()

duHast.Geometry.geometry_property_names module

Geometry property names enum class.

class duHast.Geometry.geometry_property_names.GeometryPropertyNames

Bases: object

Contains property names used in geometry classes

MIN_X = 'min_x'
MIN_Y = 'min_y'
MIN_Z = 'min_z'
MAX_X = 'max_x'
MAX_Y = 'max_y'
MAX_Z = 'max_z'
POINT1 = 'point1'
POINT2 = 'point2'
X = 'x'
Y = 'y'
Z = 'z'
ROWS = 'rows'
COLUMNS = 'columns'
DATA = 'data'

duHast.Geometry.matrix module

A matrix class.

Supports matrices from 1 x 1 up to 4 x 4.

class duHast.Geometry.matrix.Matrix(rows=None, cols=None, elements=None, j=None)

Bases: Base

A basic matrix class. Matrices up to size of 4x4 are supported only.

Parameters:
  • rows (int, optional) – Number of rows, defaults to None

  • cols (int, optional) – Number of columns, defaults to None

  • elements ([[float]], optional) – The matrix, defaults to None

  • j (str or dic, optional) – A json formatted settings string or dictionary, defaults to None

Raises:
  • TypeError – Thrown if row is not an integer and no json is provided

  • TypeError – Thrown if cols is not an integer and no json is provided

  • ValueError – Thrown if matrix size exceeds 4 x 4 or is rows or columns is less than 1

  • ValueError – Thrown if elements provided do not match rows and cols count

property rows

Read-only property for the number of rows.

property columns

Read-only property for the number of columns.

property data

Read-only property for the matrix data.

duHast.Geometry.point_2 module

A 2D point class.

class duHast.Geometry.point_2.Point2(x=None, y=None, j=None)

Bases: PointBase

A 2D point class.

Parameters:
  • x (double) – x-coordinate of point

  • y (double) – y-coordinate of point

duHast.Geometry.point_3 module

A 3D point class.

class duHast.Geometry.point_3.Point3(x=None, y=None, z=None, j=None)

Bases: PointBase

A #D point class.

Parameters:
  • x (double) – x-coordinate of point

  • y (double) – y-coordinate of point

  • z (double) – z-coordinate of point

duHast.Geometry.point_base module

A point base class.

class duHast.Geometry.point_base.PointBase(x=None, y=None, j=None)

Bases: Base

A point base class. Should not be used directly.

Parameters:
  • x (double) – x-coordinate of point

  • y (double) – y-coordinate of point

property json_ini

Read-only property to access the parsed JSON data.

duHast.Geometry.vector_2 module

A 2D vector class.

class duHast.Geometry.vector_2.Vector2(x, y)

Bases: VectorBase

A 2D vector class

Parameters:
  • x (double) – Delta x

  • y (double) – Delta y

property x
property y

duHast.Geometry.vector_3 module

A 3D vector class.

class duHast.Geometry.vector_3.Vector3(x, y, z)

Bases: VectorBase

A 3D vector class

Parameters:
  • x (double) – Delta x

  • y (double) – Delta y

  • z (double) – Delta z

property x
property y
property z

duHast.Geometry.vector_base module

A vector base class.

class duHast.Geometry.vector_base.VectorBase(*components)

Bases: Base

A vector base class.

magnitude()

Module contents