box module

class amulet.api.selection.SelectionBox(boxes=None)[source]

Bases: object

Holding class for multiple SubBoxes which allows for non-rectangular and non-contiguous selections

add_box(other, do_merge_check=True)[source]

Adds a SubBox to the selection box. If other is next to another SubBox in the selection, matches in any 2 dimensions, and do_merge_check is True, then the 2 boxes will be combined into 1 box.

  • other (SubBox) – The box to add
  • do_merge_check (bool) – Boolean flag to merge boxes if able

Checks if the SelectionBox is a rectangle

Return type:bool
Returns:True is the selection is a rectangle, False otherwise

Returns an iterator of the SubBoxes in the SelectionBoxes

Return type:Iterator[SubBox]
Returns:An iterator of the SubBoxes
class amulet.api.selection.SubBox(min_point, max_point)[source]

Bases: object

A SubBox is a box that can represent the entirety of a SelectionBox or just a subsection of one. This allows for non-rectangular and non-contiguous selections.

The both the minimum and maximum coordinate points are inclusive.


Method to check whether this instance of SubBox intersects another SubBox

Parameters:other (SubBox) – The other SubBox to check for intersection
Return type:bool
Returns:True if the two SubBoxes intersect, False otherwise

Converts the SubBoxes minimum/maximum coordinates into slice arguments

Return type:List[slice]
Returns:The SubBoxes coordinates as slices in (x,y,z) order