Skip to content

sliding_box.scad

pinkfish edited this page Nov 26, 2025 · 20 revisions

LibFile: sliding_box.scad

This file has all the modules needed to generate a sliding box.

To use, add the following lines to the beginning of your file:

include <boardgame_toolkit.scad>

File Contents

  1. Section: SlidingBox

Section: SlidingBox

All the pieces for making sliding lids and different types of sliding lids/boxes.

Module: SlidingLid()

Topics: SlidingBox, SlidingLid

Usage:

  • SlidingLid(width=10, length=30, lid_thickness=3, wall_thickness = 2, size_spacing = 0.2);

Description:

Creates a sliding lid for a sliding lid box, the children to this module are inserted into the lid. This does all the right things on the edges, uses some wiggle room to add in a buffer and also does a small amount of angling on the ends to make them easier to insert.

Arguments:

By Position What it does
width the width of the box itself
length the length of the box itself
lid_thickness thickness of the lid (default default_lid_thickness)
wall_thickness thickness of the walls (default default_wall_thickness)
size_spacing how much of an offset to use in generate the slides spacing on all four sides defaults to
[m\_piece\_wiggle\_room](base_bgtk.scad#constant-m_piece_wiggle_room)
lid_on_length lid along the length of the box (default false)
material_colour the colour of the material in the box (default default_material_colour)

Example 1:

SlidingLid() Example 1
include <boardgame_toolkit.scad>
SlidingLid(width=100, length=100, lid_thickness=3, wall_thickness = 2)
  translate([ 10, 10, 0 ])
    LidMeshHex(width = 100, length = 100, lid_thickness = 3, boundary = 10, radius = 12);

Example 2:

SlidingLid() Example 2
include <boardgame_toolkit.scad>
SlidingLid(width=100, length=100, lid_thickness=3, wall_thickness = 2, lid_on_length = true)
  translate([ 10, 10, 0 ])
    LidMeshHex(width = 100, length = 100, lid_thickness = 3, boundary = 10, radius = 12);

Module: SlidingBoxLidWithCustomShape()

Topics: SlidingBox, SlidingLid

Usage: SlidingBoxLidWithCustomShape(100, 50);

Description:

Lid for a sliding lid box. This uses the first child as the shape for repeating on the lid and the rest as children for the lid.

Arguments:

By Position What it does
width outside width of the box
length outside length of the box
lid_boundary boundary around the outside for the lid (default 10)
lid_thickness thickness of the lid (default default_lid_thickness)
size_sizeing amount of wiggle room between pieces (default m_piece_wiggle_room)
layout_width the width of the layout pieces (default default_lid_layout_width)
shape_width width of the shape (default default_lid_shape_width)
shape_thickness how wide the pieces are (default default_lid_shape_thickness)
aspect_ratio the aspect ratio (multiple by dy) (default default_lid_aspect_ratio)
size_spacing extra spacing to apply between pieces (default m_piece_wiggle_room)
lid_rounding how much rounding on the edge of the lid (default wall_thickness/2)
lid_on_length lid along the length of the box (default false)
material_colour the colour of the material in the box (default default_material_colour)

Example 1:

SlidingBoxLidWithCustomShape() Example 1
include <boardgame_toolkit.scad>
SlidingBoxLidWithCustomShape(100, 50) {
  ShapeByType(shape_type = SHAPE_TYPE_SUPERSHAPE, shape_thickness = 2, supershape_m1 = 12, supershape_m2 = 12,
     supershape_n1 = 1, supershape_b = 1.5, shape_width = 15);
}

Module: SlidingBoxLidWithLabelAndCustomShape()

Topics: SlidingBox, SlidingLid

Usage: SlidingBoxLidWithLabelAndCustomShape(100, 50, text\_str = "Frog");

Description:

Lid for a sliding lid box. This uses the first child as the shape for repeating on the lid.

Arguments:

By Position What it does
width outside width of the box
length outside length of the box
lid_boundary boundary around the outside for the lid (default 10)
lid_thickness thickness of the lid (default default_lid_thickness)
size_sizeing amount of wiggle room between pieces (default m_piece_wiggle_room)
text_str the string to use for the label
text_length the length of the text to use (defaults to 3/4 of length/width)
text_scale the scale of the text, making it higher or shorter on the width (default 1.0)
label_radius radius of the label corners (default text_width/4)
label_type the type of the label (default default_label_type)
label_border border of the item (default 2)
label_offset offset in from the edge for the label (default 4)
layout_width the width of the layout pieces (default default_lid_layout_width)
shape_width width of the shape (default default_lid_shape_width)
shape_thickness how wide the pieces are (default default_lid_shape_thickness)
aspect_ratio the aspect ratio (multiple by dy) (default default_lid_aspect_ratio)
size_spacing extra spacing to apply between pieces (default m_piece_wiggle_room)
lid_rounding how much rounding on the edge of the lid (default wall_thickness/2)
lid_on_length lid along the length of the box (default false)
label_colour the color of the label (default undef)
material_colour the colour of the material in the box (default default_material_colour)
label_background_colour the colour of the label background (default default_label_background_colour)

Example 1:

SlidingBoxLidWithLabelAndCustomShape() Example 1
include <boardgame_toolkit.scad>
SlidingBoxLidWithLabelAndCustomShape(100, 50, text_str = "Frog") {
  ShapeByType(shape_type = SHAPE_TYPE_SUPERSHAPE, shape_thickness = 2, supershape_m1 = 12, supershape_m2 = 12,
     supershape_n1 = 1, supershape_b = 1.5, shape_width = 15);
}

Module: SlidingBoxLidWithLabel

Topics: SlidingBox, SlidingLid

Usage:

  • SlidingBoxLidWithLabel(width = 100, length = 100, lid_thickness = 3, text_str
  • = "Trains");

Description:

This is a composite method that joins together the other pieces to make a simple lid with a label and a hex grid. The children to this as also pulled out of the lid so can be used to build more complicated lids.

Arguments:

By Position What it does
width width of the box (outside dimension)
length length of the box (outside dimension)
text_str The string to write
lid_thickness thickness of the lid (default default_lid_thickness)
wall_thickness thickness of the walls (default default_wall_thickness)
floor_thickness thickness of the floor (default default_floor_thickness)
lid_boundary how much boundary should be around the pattern (default 10)
text_length the length of the text to use (defaults to 3/4 of length/width)
text_scale the scale of the text, making it higher or shorter on the width (default 1.0)
label_radius radius of the label corners (default text_width/4)
label_type the type of the label (default default_label_type)
label_border how wide the border strip on the label should be (default 2)
label_offset how far inside the border the label should be (default 4)
layout_width the width of the layout pieces (default default_lid_layout_width)
shape_width width of the shape (default default_lid_shape_width)
shape_thickness how wide the pieces are (default default_lid_shape_thickness)
aspect_ratio the aspect ratio (multiple by dy) (default default_lid_aspect_ratio)
size_spacing how much of an offset to use in generate the slides spacing on all four sides defaults to
[m\_piece\_wiggle\_room](base_bgtk.scad#constant-m_piece_wiggle_room)
lid_on_length lid along the length of the box (default false)
label_colour the color of the label (default undef)
material_colour the colour of the material in the box (default default_material_colour)
label_background_colour the colour of the label background (default default_label_background_colour)

Example 1:

SlidingBoxLidWithLabel Example 1
include <boardgame_toolkit.scad>
SlidingBoxLidWithLabel(
    width = 100, length = 100, lid_thickness = 3, text_str = "Trains");

Module: SlidingBoxLidWithShape

Topics: SlidingBox, SlidingLid

Usage:

  • SlidingBoxLidWithShape(width = 100, length = 100, lid_thickness = 3);

Description:

This is a composite method that joins together the other pieces to make a simple lid with a label and a hex grid. The children to this as also pulled out of the lid so can be used to build more complicated lids.

Arguments:

By Position What it does
width width of the box (outside dimension)
length length of the box (outside dimension)
lid_thickness thickness of the lid (default default_lid_thickness)
wall_thickness thickness of the walls (default default_wall_thickness)
floor_thickness thickness of the floor (default default_floor_thickness)
lid_boundary how much boundary should be around the pattern (default 10)
layout_width the width of the layout pieces (default default_lid_layout_width)
shape_width width of the shape (default default_lid_shape_width)
shape_thickness how wide the pieces are (default default_lid_shape_thickness)
aspect_ratio the aspect ratio (multiple by dy) (default default_lid_aspect_ratio)
size_spacing how much of an offset to use in generate the slides spacing on all four sides defaults to
[m\_piece\_wiggle\_room](base_bgtk.scad#constant-m_piece_wiggle_room)
lid_on_length lid along the length of the box (default false)
label_colour the color of the label (default undef)
material_colour the colour of the material in the box (default default_material_colour)
label_background_colour the colour of the label background (default default_label_background_colour)

Example 1:

SlidingBoxLidWithShape Example 1
include <boardgame_toolkit.scad>
SlidingBoxLidWithShape(
    width = 100, length = 100, lid_thickness = 3);




Module: MakeBoxWithSlidingLid()

Topics: SlidingBox

Usage:

  • MakeBoxWithSlidingLid(50,100,20);

Description:

Makes a box with a sliding lid, this just creates the box itself with the cutouts for the sliding lid pieces. The children to this will be removed from inside the box and how to add in the cutouts.

The children all start from the edge inside the wall width and up from the floor in the box.

Inside the children of the box you can use the $inner_height , $inner_width, $inner_length = length variables to deal with the box sizes.

Arguments:

By Position What it does
width width of the box (outside width)
length length of the box (outside length)
height height of the box (outside height)
lid_thickness thickness of the lid (default default_lid_thickness)
wall_thickness thickness of the walls (default default_wall_thickness)
floor_thickness thickness of the floor (default default_floor_thickness)
lid_on_length lid along the length of the box (default false)
material_colour the colour of the material in the box (default default_material_colour)
positive_only_children the list of children to be positive only
positive_negative_children the list of children to be positive and negative
positive_colour colour of the postive pieces default_positive_colour

Example 1:

MakeBoxWithSlidingLid() Example 1
include <boardgame_toolkit.scad>
MakeBoxWithSlidingLid(50, 100, 20);




Clone this wiki locally