ladybug_geometry.interop.stl module

A class that supports the import and export of STL data to/from ladybug_geometry.

The methods in the object below are inspired from pySTL module.

[1] Daniel Balzerson. 2013. pySTL - Python code for working with .STL (sterolithography) files. https://github.com/proverbialsunrise/pySTL

class ladybug_geometry.interop.stl.STL(face_vertices, face_normals, name='polyhedron')[source]

Bases: object

A class that supports the import and export of STL data to/from ladybug_geometry.

Parameters:
  • face_vertices – A list of tuples where each tuple is a triangular face of three Point3Ds.

  • face_normals – A list of Vector3Ds for the normals of the faces in the STL.

  • name – Text string for the name of the solid object in the STL file. (Default: polyhedron).

Properties:
  • name

  • face_vertices

  • face_normals

classmethod from_file(file_path)[source]

Create an STL object from a .stl file.

Parameters:

file_path – Path to an STL file as a text string. The STL file can be in either ASCII or binary format.

classmethod from_mesh3d(mesh, name='polyhedron')[source]

Create an STL object from a ladybug_geometry Mesh3D object.

All quad faces will be automatically triangulated by using this method.

Parameters:
  • mesh – A ladybug_geometry Mesh3D object to be converted to an OBJ object.

  • name – Text string for the name of the solid object in the STL file. (Default: polyhedron).

to_file(folder, name=None)[source]

Write the STL object to an ASCII STL file.

Parameters:
  • folder – A text string for the directory where the STL will be written.

  • name – A text string for the name of the STL file. If None, the name of the STL object will be used. (Default: None).

property face_normals

Get a list of Vector3Ds for the normals of the faces in the STL.

property face_vertices

Get a list of tuples where each tuple is a triangular face of three Point3Ds.

property name

Get the name of the solid object in the STL file.