fairyfly.boundary module

Dragonfly Context Shade.

class fairyfly.boundary.Boundary(geometry, identifier=None)[source]

Bases: _Base

A Context Shade object defined by an array of Face3Ds and/or Mesh3Ds.

Parameters:
  • geometry – An array of ladybug_geometry LineSegment3D objects that together represent a type of boundary in a construction detail.

  • identifier – Text string for a unique Boundary ID. Must be a UUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. If None, a UUID will automatically be generated. (Default: None).

Properties:
  • identifier

  • display_name

  • therm_uuid

  • full_id

  • parent

  • has_parent

  • geometry

  • vertices

  • length

  • min

  • max

  • center

  • user_data

ToString()

Overwrite .NET ToString.

check_planar(tolerance=0.01, raise_exception=True, detailed=False)[source]

Check whether all of the Boundary’s vertices lie within the same plane.

Parameters:
  • tolerance – The minimum distance between a given vertex and a the object’s plane at which the vertex is said to lie in the plane. Default: 0.01, suitable for objects in millimeters.

  • raise_exception – Boolean to note whether an ValueError should be raised if a vertex does not lie within the object’s plane.

  • detailed – Boolean for whether the returned object is a detailed list of dicts with error info or a string with a message. (Default: False).

Returns:

A string with the message or a list with a dictionary if detailed is True.

duplicate()

Get a copy of this object.

classmethod from_dict(data)[source]

Initialize an Boundary from a dictionary.

Parameters:

data – A dictionary representation of an Boundary object.

classmethod from_vertices(vertices, identifier=None)[source]

Create a Boundary from vertices with each vertex as an iterable of 3 floats.

Parameters:
  • vertices – A list of lists where each sub-list represents a line segment or polyline with 2 or more vertices. Each vertex is represented as an iterable of three (x, y, z) floats.

  • identifier – Text string for a unique Shape ID. Must be a UUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. If None, a UUID will automatically be generated. (Default: None).

move(moving_vec)[source]

Move this Boundary along a vector.

Parameters:

moving_vec – A ladybug_geometry Vector3D with the direction and distance to move the object.

reflect(plane)[source]

Reflect this Boundary across a plane.

Parameters:

plane – A ladybug_geometry Plane across which the object will be reflected.

rename_by_attribute(format_str='{display_name} - {length}')[source]

Set the display name of this Boundary using a format string with attributes.

Parameters:

format_str – Text string for the pattern with which the Boundary will be renamed. Any property on this class may be used and each property should be put in curly brackets. Nested properties can be specified by using “.” to denote nesting levels (eg. properties.energy.construction.display_name). Functions that return string outputs can also be passed here as long as these functions defaults specified for all arguments.

rotate(axis, angle, origin)[source]

Rotate this Shape by a certain angle around an axis and origin.

Parameters:
  • axis – A ladybug_geometry Vector3D axis representing the axis of rotation.

  • angle – An angle for rotation in degrees.

  • origin – A ladybug_geometry Point3D for the origin around which the object will be rotated.

rotate_xy(angle, origin)[source]

Rotate this Boundary counterclockwise in the XY plane by a certain angle.

Parameters:
  • angle – An angle in degrees.

  • origin – A ladybug_geometry Point3D for the origin around which the object will be rotated.

scale(factor, origin=None)[source]

Scale this Boundary by a factor from an origin point.

Parameters:
  • factor – A number representing how much the object should be scaled.

  • origin – A ladybug_geometry Point3D representing the origin from which to scale. If None, it will be scaled from the World origin (0, 0, 0).

to_dict(abridged=False, included_prop=None)[source]

Return Boundary as a dictionary.

Parameters:
  • abridged – Boolean to note whether the extension properties of the object (ie. materials, transmittance schedule) should be included in detail (False) or just referenced by identifier (True). Default: False.

  • included_prop – List of properties to filter keys that must be included in output dictionary. For example [‘therm’] will include ‘therm’ key if available in properties to_dict. By default all the keys will be included. To exclude all the keys from extensions use an empty list.

property center

A Point3D for the center of the bounding box around the object.

property display_name

Get or set a string for the object name without any character restrictions.

If not set, this will be equal to the identifier.

property full_id

Get a string with both the object display_name and identifier.

This is formatted as display_name[identifier].

This is useful in error messages to give users an easy means of finding invalid objects within models. If there is no display_name assigned, only the identifier will be returned.

property geometry

Get a tuple of LineSegment3D objects that represent the boundary.

property has_parent

Get a boolean noting whether this Shape has a parent object.

property identifier

Get or set a text string for the unique object identifier.

This must be a UUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and it remains constant as the object is mutated, copied, and serialized to different formats (eg. therm XML). As such, this property is used to reference the object across a Model.

property length

Get a number for the total length of the Boundary.

property max

Get a Point3D for the maximum of the bounding box around the object.

property min

Get a Point3D for the minimum of the bounding box around the object.

property parent

Get the parent object if assigned. None if not assigned.

The parent object is typically a GlazingSystem.

property properties

Get object properties, including THERM and other properties.

property therm_uuid

Get the UUID of this object as it would appear in a THERM XML or thmz file.

This is always derived from the object identifier but this is slightly different than standard UUIDs, which have 4 more values in a 8-4-4-4-12 structure instead of a 8-4-4-12 structure used by THERM.

property to

Boundary writer object.

Use this method to access Writer class to write the context in other formats.

property user_data

Get or set an optional dictionary for additional meta data for this object.

This will be None until it has been set. All keys and values of this dictionary should be of a standard Python type to ensure correct serialization of the object to/from JSON (eg. str, float, int, list, dict)

property vertices

Get a list of vertices for the boundary.