pyboxbuilder.preview.remove_top_layers

pyboxbuilder.preview.remove_top_layers(placements: collections.abc.Sequence[Piece], count: int) → list[Piece][source]

Drop the top count vertical layers from a set of placements.

A box is removed when its top surface rises above the cut, so a tall box spanning into a removed layer goes with it rather than being sliced.

Parameters:
placements: collections.abc.Sequence[Piece]

Objects carrying position and size 3-tuples.

count: int

How many layers to remove from the top. 0 keeps everything; a count at or above the number of layers removes everything.

Returns:

The surviving placements, in their original order.

Raises:

ValueError – If count is negative.