layerview.visualization.point_cloud.model module

Abstraction of model in point cloud.

class layerview.visualization.point_cloud.model.LayerInfo[source]

Bases: object

Represents information about a layer.

class layerview.visualization.point_cloud.model.Model(layer_to_z: Dict[Layer, float], nozzle_diam: float, priming_layer: Layer | None = None, priming_layer_z: float | None = None)[source]

Bases: object

Represents a point cloud model.

property _boundaries_with_priming: BoundingBox3D

Return this Model’s boundaries with the priming layer.

property _boundaries_without_priming: BoundingBox3D

Return this Model’s boundaries without the priming layer.

get_boundaries(with_priming: bool) BoundingBox3D[source]

Return this Model’s boundaries.

Parameters:

with_priming (bool) – If True, the priming layer is taken into account (if present). Otherwise, the priming layer is ignored.

Returns:

This Model’s boundaries.

Return type:

BoundingBox3D

get_layer_height(index: int) float[source]

Return height (top-bottom) of layer at specified index.

The calculated height is rounded to 3 decimal places.

Parameters:

index (int) – Index of layer to return the height for.

Returns:

Height of layer at specified index.

Return type:

float

get_layer_z(index: int) float[source]

Return Z position of layer at specified index.

Parameters:

index (int) – Index of layer to return the Z position for.

Returns:

Z position of layer at specified index.

Return type:

float

property info: ModelInfo

Return ModelInfo for this Model.

property nozzle_diam: float

Return nozzle diameter for this Model.

property priming_layer: Layer | None

Return priming layer for this Model.

property priming_layer_z: float | None

Return priming layer Z position for this Model.

class layerview.visualization.point_cloud.model.ModelBuilder[source]

Bases: object

Point cloud model builder.

_handle_move(command: Move)[source]

Handle Move command.

Parameters:

command (commands.Move) – Move command to handle.

Raises:

TypeError – If command is not a Move instance.

static add_segment_to_layer(layer: Layer, source: LVector2d, destination: LVector2d)[source]

Add segment to specified layer.

If layer does not contain any previous paths or the last path’s point is not equal to the provided source point, a new path is initialized. Otherwise the destination point is appended to the end of layer’s last path.

Parameters:
  • layer (Layer) – Layer to add the segment to.

  • source (LVector2d) – Segment’s source point.

  • destination (LVector2d) – Segment’s destination point.

static build_model(gcode: Gcode, nozzle_diam: float) Model[source]

Build 3D model, based on the provided Gcode and nozzle diameter.

Parameters:
  • gcode (Gcode) – Gcode object to generate the point_cloud model from.

  • nozzle_diam (float) – Nozzle diameter.

Returns:

model – Generated point_cloud Model.

Return type:

Model

get_layer_at_z(layer_z: float) Layer[source]

Return layer at specified Z position.

Parameters:

layer_z (float) – Z position of layer to return.

Returns:

Layer at specified Z position.

Return type:

Layer

Raises:
handle_command(command: Command)[source]

Handle command.

Parameters:

command (commands.Command) – Command to handle.

class layerview.visualization.point_cloud.model.ModelInfo[source]

Bases: object

Represents information about a model.

property _heights: List[float]

Return list of layer heights (aka thicknesses).

property feedrate_max: float

Return maximum feedrate.

property feedrate_min: float

Return minimum feedrate.

static from_model(model: Model) ModelInfo[source]

Builds ModelInfo from specified Model instance.

Parameters:

model (Model) – Model for which the ModelInfo is built.

Returns:

Built ModelInfo instance.

Return type:

ModelInfo

get_layer_height(index: int) float[source]

Return height (aka thickness) of layer at specified index.

Parameters:

index (int) – Index of layer to return the height for.

Returns:

Height of layer at specified index.

Return type:

float

get_layer_info(index: int) LayerInfo[source]

Return LayerInfo for layer at specified index.

Parameters:

index (int) – Index of layer to return the LayerInfo for.

Returns:

LayerInfo for layer at specified index.

Return type:

LayerInfo

get_layer_z(index: int) float[source]

Return Z position of layer at specified index.

Parameters:

index (int) – Index of layer to return the Z position for.

Returns:

Z position of layer at specified index.

Return type:

float

property index_to_layer_info: Dict[int, LayerInfo]

Return dict that maps layer index to corresponding LayerInfo instance.

Returns:

Maps layer index to corresponding LayerInfo instance.

Return type:

LayerInfo

property layer_count: int

Return total layer count.

property layer_height_max: float

Return maximum layer height (aka thickness).

property layer_height_min: float

Return minimum layer height (aka thickness).

property layer_num_max: int

Return maximum layer number (index).

property layer_num_min: int

Return minimum layer number (index).

property layer_range: Tuple[int, int]

Return available layer number (index) range, inclusive.

property temperature_max: float

Return maximum nozzle temperature.

property temperature_min: float

Return maximum nozzle temperature.