Skip to content

Rounded canister base

RoundedCanisterBase

RoundedCanisterBase(
    tube_ext_diameter,
    tube_thickness,
    caps_height=8,
    caps_outer_thickness=1,
    clearance=0.1,
    lid_shoulder=None,
)

Generates parts for a rounded tube

Parameters:

Name Type Description Default
tube_ext_diameter float

External tube diameter

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
Source code in src/bd_tube_boxes/rounded_canister_base.py
def __init__(
    self,
    tube_ext_diameter: float,
    tube_thickness: float,
    caps_height: float = 8,
    caps_outer_thickness: float = 1,
    clearance: float = 0.1,
    lid_shoulder: float | None = None,
):
    """
    Generates parts for a rounded tube

    Args:
        tube_ext_diameter (float): External tube diameter
        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`
    """
    self.tube_ext_diam = tube_ext_diameter
    self.tube_thickness = tube_thickness
    self.cap_height = caps_height
    self.cap_outer_thickness = caps_outer_thickness
    self.clearance = clearance

    self.lid_shoulder = lid_shoulder if lid_shoulder is not None else self.cap_height / 5

    self.tube_final_outer_radius = self.tube_ext_diam / 2 + self.clearance
    self.tube_final_inner_radius = (self.tube_ext_diam / 2 - self.tube_thickness) - self.clearance
    self.part_final_outer_radius = self.tube_final_outer_radius + self.cap_outer_thickness
    self.cap_lid_hole_wall_thickness = self.cap_outer_thickness + self.lid_shoulder
    self.cap_lid_hole_radius = self.tube_final_inner_radius - self.cap_lid_hole_wall_thickness + self.clearance

cap_height instance-attribute

cap_height = caps_height

Input: caps height

cap_lid_hole_radius instance-attribute

cap_lid_hole_radius = (
    tube_final_inner_radius
    - cap_lid_hole_wall_thickness
    + clearance
)

Radius of the screw hole in the cap. Includes clearance

cap_lid_hole_wall_thickness instance-attribute

cap_lid_hole_wall_thickness = (
    cap_outer_thickness + lid_shoulder
)

Thickness of the wall for the lid hole

cap_outer_thickness instance-attribute

cap_outer_thickness = caps_outer_thickness

Input: caps outer thickness

clearance instance-attribute

clearance = clearance

Clearance on both sides of the tube

lid_shoulder instance-attribute

lid_shoulder = (
    lid_shoulder
    if lid_shoulder is not None
    else cap_height / 5
)

part_final_outer_radius instance-attribute

part_final_outer_radius = (
    tube_final_outer_radius + cap_outer_thickness
)

Radius for the inside of the tube

thread_pitch instance-attribute

thread_pitch

Thread pitch

tube_ext_diam instance-attribute

tube_ext_diam = tube_ext_diameter

Input: tube diameter

tube_final_inner_radius instance-attribute

tube_final_inner_radius = (
    tube_ext_diam / 2 - tube_thickness - clearance
)

External radius of the part

tube_final_outer_radius instance-attribute

tube_final_outer_radius = tube_ext_diam / 2 + clearance

Radius for the outside of the tube

tube_thickness instance-attribute

tube_thickness = tube_thickness

Input: tube thickness

bottom

bottom(
    rotation=(0, 0, 0),
    align=(Align.CENTER, Align.CENTER, Align.MIN),
    mode=Mode.ADD,
)

Creates the bottom part

Source code in src/bd_tube_boxes/rounded_canister_base.py
def bottom(
    self,
    rotation: RotationLike = (0, 0, 0),
    align: Align | tuple[Align, Align, Align] = (
        Align.CENTER,
        Align.CENTER,
        Align.MIN,
    ),
    mode: Mode = Mode.ADD,
):
    """
    Creates the bottom part
    """

    cap_base = self._cap_base(align=(Align.CENTER, Align.CENTER, Align.MIN))
    inset_loc = Location((0, 0, self.cap_outer_thickness))
    inset = Solid.make_cylinder(self.tube_final_inner_radius - self.cap_outer_thickness, self.cap_height)
    inset = inset_loc * inset

    solid = cap_base - inset

    return BasePartObject(part=solid, rotation=rotation, align=tuplify(align, 3), mode=mode)

lid

lid()

Creates the lid

Source code in src/bd_tube_boxes/rounded_canister_base.py
def lid(self):
    """
    Creates the lid
    """
    raise NotImplementedError

top

top(
    rotation=(0, 0, 0),
    align=(Align.CENTER, Align.CENTER, Align.MAX),
    mode=Mode.ADD,
)

Creates the top part

Source code in src/bd_tube_boxes/rounded_canister_base.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,
):
    """
    Creates the top part
    """

    solid = self._cap_base(align=(Align.CENTER, Align.CENTER, Align.MIN))

    thread = self._cap_lock()
    solid -= thread

    return BasePartObject(part=solid, rotation=rotation, align=tuplify(align, 3), mode=mode)