ladybug_display.context module¶
Class for representing geometry objects that each have custom properties.
Such properties can include color, line_width, line_type, and display_mode.
- class ladybug_display.context.ContextGeometry(identifier, geometry, hidden=False)[source]¶
Bases:
_VisualizationBase
An object representing context geometry to display.
- Parameters:
identifier – Text string for a unique object ID. Must be less than 100 characters and not contain spaces or special characters.
geometry – A list of ladybug-geometry or ladybug-display objects that gives context to analysis geometry or other aspects of the visualization. Typically, these will display in wireframe around the geometry, though the properties of display geometry can be used to customize the visualization.
hidden – A boolean to note whether the geometry is hidden by default and must be un-hidden to be visible in the 3D scene. (Default: False).
- Properties:
identifier
display_name
geometry
hidden
min_point
max_point
user_data
- duplicate()¶
Get a copy of this object.
- classmethod from_dict(data)[source]¶
Create an ContextGeometry from a dictionary.
- Parameters:
data – A python dictionary in the following format
{ "type": "ContextGeometry", "identifier": "", # unique object identifier "geometry": [], # list of ladybug-display geometry objects "hidden": True # boolean for whether the layer is hidden by default }
- static geometry_to_wireframe(geometry)[source]¶
Convert a raw ladybug-geometry object into a wireframe ladybug-display object.
- Parameters:
geometry – A raw ladybug-geometry object to be converted to a wireframe ladybug-display object.
- move(moving_vec)[source]¶
Move this ContextGeometry along a vector.
- Parameters:
moving_vec – A ladybug_geometry Vector3D with the direction and distance to move the ContextGeometry.
- rotate_xy(angle, origin)[source]¶
Rotate this ContextGeometry counterclockwise in the world XY plane.
- 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 ContextGeometry 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).
- WIREFRAME_MAP = {<class 'ladybug_geometry.geometry2d.arc.Arc2D'>: (<class 'ladybug_display.geometry2d.arc.DisplayArc2D'>, None), <class 'ladybug_geometry.geometry2d.line.LineSegment2D'>: (<class 'ladybug_display.geometry2d.line.DisplayLineSegment2D'>, None), <class 'ladybug_geometry.geometry2d.mesh.Mesh2D'>: (<class 'ladybug_display.geometry2d.mesh.DisplayMesh2D'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry2d.pointvector.Point2D'>: (<class 'ladybug_display.geometry2d.point.DisplayPoint2D'>, None), <class 'ladybug_geometry.geometry2d.pointvector.Vector2D'>: (<class 'ladybug_display.geometry2d.vector.DisplayVector2D'>, None), <class 'ladybug_geometry.geometry2d.polygon.Polygon2D'>: (<class 'ladybug_display.geometry2d.polygon.DisplayPolygon2D'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry2d.polyline.Polyline2D'>: (<class 'ladybug_display.geometry2d.polyline.DisplayPolyline2D'>, None), <class 'ladybug_geometry.geometry2d.ray.Ray2D'>: (<class 'ladybug_display.geometry2d.ray.DisplayRay2D'>, None), <class 'ladybug_geometry.geometry3d.arc.Arc3D'>: (<class 'ladybug_display.geometry3d.arc.DisplayArc3D'>, None), <class 'ladybug_geometry.geometry3d.cone.Cone'>: (<class 'ladybug_display.geometry3d.cone.DisplayCone'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry3d.cylinder.Cylinder'>: (<class 'ladybug_display.geometry3d.cylinder.DisplayCylinder'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry3d.face.Face3D'>: (<class 'ladybug_display.geometry3d.face.DisplayFace3D'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry3d.line.LineSegment3D'>: (<class 'ladybug_display.geometry3d.line.DisplayLineSegment3D'>, None), <class 'ladybug_geometry.geometry3d.mesh.Mesh3D'>: (<class 'ladybug_display.geometry3d.mesh.DisplayMesh3D'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry3d.plane.Plane'>: (<class 'ladybug_display.geometry3d.plane.DisplayPlane'>, None), <class 'ladybug_geometry.geometry3d.pointvector.Point3D'>: (<class 'ladybug_display.geometry3d.point.DisplayPoint3D'>, None), <class 'ladybug_geometry.geometry3d.pointvector.Vector3D'>: (<class 'ladybug_display.geometry3d.vector.DisplayVector3D'>, None), <class 'ladybug_geometry.geometry3d.polyface.Polyface3D'>: (<class 'ladybug_display.geometry3d.polyface.DisplayPolyface3D'>, None, 'Wireframe'), <class 'ladybug_geometry.geometry3d.polyline.Polyline3D'>: (<class 'ladybug_display.geometry3d.polyline.DisplayPolyline3D'>, None), <class 'ladybug_geometry.geometry3d.ray.Ray3D'>: (<class 'ladybug_display.geometry3d.ray.DisplayRay3D'>, None), <class 'ladybug_geometry.geometry3d.sphere.Sphere'>: (<class 'ladybug_display.geometry3d.sphere.DisplaySphere'>, None, 'Wireframe')}¶
- property display_name¶
Get or set text for the object name without any character restrictions.
This is typically used to set the layer of the object in the interface that renders the VisualizationSet. A :: in the display_name can be used to denote sub-layers following a convention of ParentLayer::SubLayer.
If not set, the display_name will be equal to the object 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 or set a tuple of ladybug_display geometry objects for context.
When setting this property, it is also acceptable to include raw ladybug_geometry objects in the list and they will automatically be converted into a wireframe representation as a ladybug-display object.
Get or set a boolean for whether the geometry is hidden by default.
- property identifier¶
Get or set a text string for the unique object identifier.
This identifier remains constant as the object is mutated, copied, and serialized to different formats.
- property max_point¶
A Point3D for the maximum bounding box vertex around all of the geometry.
- property min_point¶
A Point3D for the minimum bounding box vertex around all of the geometry.
- 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)