Skip to content

card_library.scad

pinkfish edited this page Jun 6, 2026 · 1 revision

LibFile: card_library.scad

A special card library box for card heavy games.

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

include <boardgame_toolkit.scad>

File Contents

Function: MakeCardSize()

Topics: Hinges, CardLibrary

Description:

Creates a card size object.

Arguments:

By Position What it does
width width of the cards
length length of the cards
single_card_thickness thickness of a single card

Example 1:

include <boardgame_toolkit.scad>
MakeCardSize(93, 62, 0.1);




Function: sumVec()

Topics: Hinges, CardLibrary

Description:

Sums all the vectors together to get a final result.

Arguments:

By Position What it does
vec the vector to sum
index the current index (default 0)
sum the current sum (default 0)

Example 1:

include <boardgame_toolkit.scad>
sumVec([1, 2, 3]);




Function: TotalCards()

Topics: Hinges, CardLibrary

Description:

Calculates the total number of cards, whether it is a single number or an array.

Arguments:

By Position What it does
num_cards number of cards or array of number of cards

Example 1:

include <boardgame_toolkit.scad>
TotalCards([10, 20]);




Function: sumCardsTo()

Description:

Sums the first N cards in an array.


Function: InternalBarriers()

Topics: Hinges, CardLibrary

Description:

Calculates the number of internal barriers needed for an array of cards.

Arguments:

By Position What it does
num_cards number of cards or array of number of cards

Function: SleeveSizeWidth()

Topics: Hinges, CardLibrary

Description:

Calculates the width of a card sleeve.

Arguments:

By Position What it does
num_cards number of cards in the sleeve (can be an array of numbers)
card_size the card size object
wall_thickness thickness of the walls (default (default_wall_thickness)

Example 1:

include <boardgame_toolkit.scad>
SleeveSizeWidth(10);




Function: SleeveSize()

Topics: Hinges, CardLibrary

Description:

Calculates the size of a card sleeve.

Arguments:

By Position What it does
num_cards number of cards in the sleeve (can be an array of numbers)
card_size the card size object
wall_thickness thickness of the walls (default (default_wall_thickness)

Example 1:

include <boardgame_toolkit.scad>
SleeveSize(10);




Function: CardLibrarySize()

Topics: Hinges, CardLibrary

Description:

Calculates the size of a card library box.

Arguments:

By Position What it does
array array of card arrays
card_size the card size object
wall_thickness thickness of the walls (default (default_wall_thickness)
lid_thickness thickness of the lid (default (default_lid_thickness))
floor_thickness thickness of the floor (default (default_floor_thickness))

Example 1:

include <boardgame_toolkit.scad>
CardLibrarySize([["Card 1", 10], ["Card 2", 20]]);




Module: MakeCardLibraryBox()

Topics: Hinges, CardLibrary

Description:

Makes a card library box with the specified latch type.

Arguments:

By Position What it does
size the size of the object [width, length, height]
floor_thickness thickness of the floor
wall_thickness thickness of the walls
lip_size size of the lip (default default_floor_thickness * 3)
lid_thickness thickness of the lid
material_colour the colour of the material in the box (default "magenta")
latch latch type to use (default CARD_LIBRARY_LATCH_SLIDING)
hinge_hole_diameter diameter of the hinge hole (default 2.2)

Example 1:

MakeCardLibraryBox() Example 1
include <boardgame_toolkit.scad>
MakeCardLibraryBox([100, 50, 20]);




Module: SlidingChannel()

Topics: Hinges, CardLibrary

Description:

Creates a sliding channel for the card library latch.

Arguments:

By Position What it does
size the size of the object [width, length, height]
wall_thickness thickness of the walls

Module: SlidingLatch()

Topics: Hinges, CardLibrary

Description:

Creates a sliding latch for the card library box lid.

Arguments:

By Position What it does
size the size of the object [width, length, height]
print_in_place_offset offset for print-in-place mechanisms
lid_thickness thickness of the lid
wall_thickness thickness of the walls

Module: CardLibraryBoxLid()

Topics: Hinges, CardLibrary

Description:

Creates a basic lid for the card library box.

Arguments:

By Position What it does
size the size of the object [width, length, height]
wall_thickness thickness of the walls
lid_thickness thickness of the lid
lip_size size of the lip (default default_lid_thickness * 3)
lid_boundary bounding edge for shape generation on the lid (default 10)
latch latch type to use (default CARD_LIBRARY_LATCH_SLIDING)
material_colour the colour of the material in the box (default "magenta")
hinge_hole_diameter diameter of the hinge hole (default 2.2)
print_in_place_offset offset for print-in-place mechanisms (default 0.25)
size_spacing amount of wiggle room between pieces (default m_piece_wiggle_room)

Example 1:

CardLibraryBoxLid() Example 1
include <boardgame_toolkit.scad>
CardLibraryBoxLid([100, 50, 20]);




Module: CardLibraryBoxLidWithCustomShape()

Topics: Hinges, CardLibrary

Description:

Creates a lid for the card library box configured for custom shapes.

Arguments:

By Position What it does
size the size of the object [width, length, height]
wall_thickness thickness of the walls
lid_thickness thickness of the lid
lip_size size of the lip (default default_lid_thickness * 3)
latch latch type to use (default CARD_LIBRARY_LATCH_SLIDING)
material_colour the colour of the material in the box (default "magenta")
hinge_hole_diameter diameter of the hinge hole (default 2.2)
print_in_place_offset offset for print-in-place mechanisms (default 0.25)
size_spacing amount of wiggle room between pieces (default m_piece_wiggle_room)
lid_rounding how much to round the edge of the lid
lid_inner_rounding how much to round the inside of the box
lid_pattern_dense boolean if the pattern is dense
lid_dense_shape_edges number of edges for the dense shape
aspect_ratio aspect ratio of the elements
pattern_inner_control if the shape needs inner control (default false)
lid_boundary bounding edge for shape generation on the lid (default 10)
layout_width width of the layout

Module: CardLibraryBoxLidWithShape()

Topics: Hinges, CardLibrary

Description:

Creates a lid for the card library box using standard shapes.

Arguments:

By Position What it does
size the size of the object [width, length, height]
wall_thickness thickness of the walls
lid_thickness thickness of the lid
lip_size size of the lip (default default_lid_thickness * 3)
latch latch type to use (default CARD_LIBRARY_LATCH_SLIDING)
material_colour the colour of the material in the box (default "magenta")
hinge_hole_diameter diameter of the hinge hole (default 2.2)
print_in_place_offset offset for print-in-place mechanisms (default 0.25)
size_spacing amount of wiggle room between pieces (default m_piece_wiggle_room)
lid_rounding how much to round the edge of the lid
lid_inner_rounding how much to round the inside of the box
lid_pattern_dense boolean if the pattern is dense
lid_dense_shape_edges number of edges for the dense shape
pattern_inner_control if the shape needs inner control (default false)
shape_options options object for the shape
lid_boundary bounding edge for shape generation on the lid (default 10)
layout_width width of the layout
aspect_ratio aspect ratio of the elements

Module: CardLibraryBoxLidWithLabel()

Topics: Hinges, CardLibrary

Description:

Creates a lid for a card library box with a shape pattern and a label.

Arguments:

By Position What it does
size the size of the object [width, length, height]
label the string to use for the label
label_options options for the label (default undef)
wall_thickness thickness of the walls
lid_thickness thickness of the lid
lip_size size of the lip (default default_lid_thickness * 3)
latch latch type to use (default CARD_LIBRARY_LATCH_SLIDING)
material_colour the colour of the material in the box (default "magenta")
hinge_hole_diameter diameter of the hinge hole (default 2.2)
print_in_place_offset offset for print-in-place mechanisms (default 0.25)
size_spacing amount of wiggle room between pieces (default m_piece_wiggle_room)
lid_boundary bounding edge for shape generation on the lid (default 10)
layout_width width of the layout
aspect_ratio aspect ratio of the elements
shape_options options object for the shape

Module: CardSleeveForLibrary()

Topics: Hinges, CardLibrary

Description:

Creates a card sleeve configured for the library.

Arguments:

By Position What it does
card_size the size of the card using the object
wall_thickness thickness of the walls
side_wall_thickness thickness of the side walls
lip_size size of the lip
material_colour the colour of the material in the box (default "magenta")
font the font to use for the label
label_colour the color of the label
label the string to use for the label
add_positive whether to add the positive part
emboss_text amount of text embossing
text_length_offset text offset along the length

Example 1:

CardSleeveForLibrary() Example 1
include <boardgame_toolkit.scad>
CardSleeveForLibrary([60, 90, 10], MakeCardSize(width=90, length=72, single_card_thickness=0.1));

Module: MakeAllSleeves()

Topics: Hinges, CardLibrary

Description:

Makes all the sleeves for a card array.

Arguments:

By Position What it does
card_array array of card arrays (format ["card_name", card_count, "svg_filename"])
spacing spacing between sleeves (default 2)
card_size the card size object

Example 1:

MakeAllSleeves() Example 1
include <boardgame_toolkit.scad>
core_player_cards = [
  ["Agnes Baker", 34, "per_investigator"],
  ["Roland Banks", 34, "per_investigator"],
  ["Daisy Walker", 34, "per_investigator"],
  ["Skids O'Toole", 34, "per_investigator"],
  ["Wendy Adams", 34, "per_investigator"],
  ["Level 0", 15, "s_level_0"],
  ["Guardian 1+", 12, "guardian"],
  ["Survivor 1+", 12, "survivor"],
  ["Rogue 1+", 12, "rogue"],
  ["Seeker 1+", 12, "seeker"],
  ["Mystic 1+", 12, "mystic"],
  ["Neutral 1+", 10, "neutral"],
  ["Weaknesses", 10, "weakness"],
];
MakeAllSleeves(core_player_cards, spacing = 2, card_size=MakeCardSize(63.5, 88, 0.3));

Clone this wiki locally