PlanarSlicer

class compas_slicer.slicers.PlanarSlicer(mesh, slicer_type='default', layer_height=2.0, slice_height_range=None)[source]

Bases: BaseSlicer

Generates planar contours on a mesh that are parallel to the xy plane.

Attributes:
  • mesh (compas.datastructures.Mesh) – Input mesh, it must be a triangular mesh (i.e. no quads or n-gons allowed).

  • slicer_type (str) – String representing which slicing method to use. options: ‘default’, ‘cgal’

  • layer_height (float) – Distance between layers (slices).

  • slice_height_range (tuple (optional)) – Optional tuple that lets the user slice only a part of the model. Defaults to None which slices the entire model. First value is the Z height to start slicing from, second value is the Z height to end. The range values are not absolute height values, but relative to the current minimum height value of the mesh. I.e. if you want to only slice the first 100 mm of the mesh, you use (0,100) regardless of the position of the mesh.

Attributes

Inherited Attributes

horizontal_layers

Returns a list of all the layers stored in the slicer that are NOT vertical.

number_of_layers

Total number of layers.

number_of_paths

Total number of paths, number of open paths, number of closed paths.

number_of_points

Total number of points in the slicer.

vertical_layers

Returns a list of all the vertical layers stored in the slicer.

Methods

__init__(mesh[, slicer_type, layer_height, ...])

generate_paths()

Generates the planar slicing paths.

Inherited Methods

close_paths()

For paths that are labeled as closed, it makes sure that the first and the last point are identical.

find_vertical_layers_with_first_path_on_base()

from_data(data)

Construct a slicer from its data representation.

get_layers_dict()

Returns a dictionary consisting of the layers.

post_processing()

Applies standard post-processing operations: seams_align and unify_paths.

printout_info()

Prints out information from the slicing process.

remove_invalid_paths_and_layers()

Removes invalid layers and paths from the slicer.

slice_model(*args, **kwargs)

Slices the model and applies standard post-processing and removing of invalid paths.

to_data()

Returns a dictionary of structured data representing the data structure.

to_json(filepath, name)

Writes the slicer to a JSON file.