PySLM – A Python Library for 3D Printing and Additive Manufacturing (L-PBF, SLM)

PySLM - 3D Printing or Additive Manufacturing Slicer and Hatching Library for Research


PySLM is a python library for processing and generating the input files (scan paths) used in AM based processes such as:

  • Selective Laser Melting (SLM),
  • Direct Metal Laser Sintering (DMLS),
  • Selective Laser Sintering (SLS)
  • Stereo-Lithography (SLA)
  • Digital Light Projection (DLP)

Platforms typically used in both academia and industry for Additive Manufacturing. The core capabilities aim to include slicing, hatching and support generation and providing an interface to the binary build file formats available for platforms. The library is built of core classes which may provide the basic functionality to generate the scan vectors used on systems and also be used as building blocks to prototype and develop new algorithms.

Currently there is a lack of opensource software tools for researchers and hobbyists to develop and investigate the effects of build-strategy, laser-parameters on these complex manufacturing processes ranging from (residual stress, defect-generation, micro-structural effects, mechanical properties, process-optimisation, build time-cost economics and estimation).

Please see the blog for further articles writing about its development and examples of its usage.

Overview of Workflow:

PySLM is built-upon python libraries Trimesh and incorporates some custom modifications to the PyClipper libraries, which are compiled using Cython into PySLM as a built-in accessible module to prevent module namespace conflicts.


Slicing is fairly trivial due to a built-in method in Trimesh to obtain the slice from a mesh. The slice operation generates a list of boundaries/contours for each layer. From these boundaries, a number of offsetting of the boundaries is performed. Typically these are composed of an outer and inner contours which are assigned different laser parameters.


An interior hatch region is generated using a chosen ‘scan-strategy’ to the bulk region which is clipped from the boundary.

Currently three of the most standard are

  • Standard meander / Serpentine,
  • Stripe,
  • Island / Checkerboard.
Illustration of a Stripe Scan Strategy Generated using PySLM.

The scanning order for each region is generally ordered from negative to positive in the X-direction and that in the Y direction. A technique to efficiently order the scanning and clipping at the same time is explained here. Additionally ordering of scan vectors, island regions, may be performed to further optimise this. Typically, it is preferential to scan in the direction that opposes the inert gas flow to reduce the likelihood of large spatter particles landing in future areas. Other strategies exist to mitigate the effect of residual stress build-up by spatially scanning island regions.


Within each layer, scanned regions are composed of contours, hatches, or exposure points and are stored as a LayerGeometry groups. Each LayerGeometry group is assigned a unique build-style consisting of the laser parameters used for scanning the surface. The Layer consisting of LayerGeometries are then exported to the native build/machine file format. Typically the file formats have binary representations to provide efficient storage, given the number of scan vectors and layers in a build. The series of layers and other information is exported via an additional compiled c++ submodule libSLM.