Skip to content

Rectangle canister slide

RectangleCanisterSlide

RectangleCanisterSlide(
    tube_width,
    tube_length,
    tube_ext_corner_radius,
    tube_thickness,
    caps_height=8,
    caps_outer_thickness=1,
    clearance=0.1,
    lid_shoulder=None,
    lid_sliders=3,
)

Bases: RectangleCanisterBase

Generates parts for a rectangular tube with a sliding lid.


Interesting methods are:

  • top() generates the top part
  • bottom() generates the bottom part.
  • lid() generates the lid.

Parameters:

Name Type Description Default
tube_width float

Tube width

required
tube_length float

Tube length

required
tube_ext_corner_radius float

External radius of the corners

required
tube_thickness float

Tube thickness

required
caps_height float

Height for the caps

8
caps_outer_thickness float

Thickness applied to the outside of the caps (and the bottom part)

1
clearance float

Clearance used in various parts of the assembly

0.1
lid_shoulder float | None

Lid shoulder to hide the lock. When None, value is based on cap_height

None
lid_sliders int

Amount of locking sliders

3
Source code in src/bd_tube_boxes/rectangle_canister_slide.py
def __init__(
    self,
    # Base
    tube_width: float,
    tube_length: float,
    tube_ext_corner_radius: float,
    tube_thickness: float,
    caps_height: float = 8,
    caps_outer_thickness: float = 1,
    clearance: float = 0.1,
    lid_shoulder: float | None = None,
    # Specific to this class
    lid_sliders: int = 3,
):
    """
    {% 3d: /models/rectangle_slide_assembly.gltf }

    Generates parts for a rectangular tube with a sliding lid.

    ---

    Interesting methods are:

    - `top()` generates the top part
      {% 3d: /models/rectangle_slide_top.gltf }
    - `bottom()` generates the bottom part.
      {% 3d: /models/rectangle_slide_bottom.gltf }
    - `lid()` generates the lid.
      {% 3d: /models/rectangle_slide_lid.gltf }

    Args:
        tube_width (float): Tube width
        tube_length (float): Tube length
        tube_ext_corner_radius (float): External radius of the corners
        tube_thickness (float): Tube thickness
        caps_height (float): Height for the caps
        caps_outer_thickness (float): Thickness applied to the outside of the caps (and the bottom part)
        clearance (float): Clearance used in various parts of the assembly
        lid_shoulder (float|None): Lid shoulder to hide the lock. When `None`, value is based on `cap_height`
        lid_sliders (int): Amount of locking sliders
    """
    RectangleCanisterBase.__init__(
        self,
        tube_width=tube_width,
        tube_length=tube_length,
        tube_ext_corner_radius=tube_ext_corner_radius,
        tube_thickness=tube_thickness,
        caps_height=caps_height,
        caps_outer_thickness=caps_outer_thickness,
        clearance=clearance,
        lid_shoulder=lid_shoulder,
    )

    self.lid_sliders = lid_sliders

lid_sliders instance-attribute

lid_sliders = lid_sliders

Amount of sliders on the lid

lid

lid()
Source code in src/bd_tube_boxes/rectangle_canister_slide.py
def lid(self):
    return SlidingLid(
        cap_lid_hole_radius=self.cap_lid_hole_radius,
        clearance=self.clearance,
        cap_height=self.cap_height,
        cap_outer_thickness=self.cap_outer_thickness,
        lid_shoulder=self.lid_shoulder,
        cap_lid_hole_wall_thickness=self.cap_lid_hole_wall_thickness,
        lid_sliders=self.lid_sliders,
    )

top

top(
    rotation=(0, 0, 0),
    align=(Align.CENTER, Align.CENTER, Align.MAX),
    mode=Mode.ADD,
)
Source code in src/bd_tube_boxes/rectangle_canister_slide.py
def top(
    self,
    rotation: RotationLike = (0, 0, 0),
    align: Align | tuple[Align, Align, Align] = (
        Align.CENTER,
        Align.CENTER,
        Align.MAX,
    ),
    mode: Mode = Mode.ADD,
):
    # There is an issue with this part: the substraction results in two solids, so
    # we only keep the first
    solid = super(RectangleCanisterSlide, self).top(rotation, align, mode)
    return solid.solids()[0]