Skip to content

shapes.scad

pinkfish edited this page Nov 23, 2024 · 31 revisions

LibFile: shapes.scad

This file has all the modules needed to make various shapes.

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

include <boardgame_toolkit.scad>

File Contents

  1. Section: Shapes

Section: Shapes

Shapes to use in boxes and stuff.

Module: Sword2d()

Description:

2d shape of a sword.

Arguments:

By Position What it does
length length of the sword
width width of the sword
blade_width width of the blade (default width / 3)
hilt_length length of the hilt (default length / 15)
hilt_pos position on the blade where the hilt starts (default length / 7)
blade_rounding how much rounding on the end of the blade (default 1)
hilt_rounding how much rounding on the hilt (default 1)

Example 1:

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




Module: Sword2dOutline()

Description:

2d outline of a sword.

Arguments:

By Position What it does
length length of the sword
width width of the sword
blade_width width of the blade (default width / 3)
hilt_length length of the hilt (default length / 15)
hilt_pos position on the blade where the hilt starts (default length / 7)
blade_rounding how much rounding on the end of the blade (default 1)
hilt_rounding how much rounding on the hilt (default 1)
line_width how wide the line is (default 1)

Example 1:

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




Module: Crossbow2d()

Description:

A 2d crossbow shape.

Arguments:

By Position What it does
length length of the cross bpw.
width width of the cross bow
handle_width width of the handle bit (default width/8)
bow_width width of the bow section of the bow (default width/4)
outer_circle how big of a circle with the crossbow to draw (default width*2)

Example 1:

Crossbow2d() Example 1
include <boardgame_toolkit.scad>
Crossbow2d(70, 50);




Module: Crossbow2dOutline()

Description:

An outline of a 2d crossbow shape.

Arguments:

By Position What it does
length length of the cross bpw.
width width of the cross bow
handle_width width of the handle bit (default width/8)
bow_width width of the bow section of the bow (default width/4)
outer_circle how big of a circle with the crossbow to draw (default width*2)
line_width width of the line to display (default 1)

Example 1:

Crossbow2dOutline() Example 1
include <boardgame_toolkit.scad>
Crossbow2dOutline(70, 50);




Module: Sledgehammer2d()

Description:

An outline of a 2d crossbow shape.

Arguments:

By Position What it does
length length of the cross bpw.
width width of the cross bow
handle_width width of the handle bit (default width/4)
head_lenght length of the head (default length/3.5)
rounding_head rounding amoubnt on the head (default width/5)
rounding_handle rounding amount on the handle (default width/10)

Example 1:

Sledgehammer2d() Example 1
include <boardgame_toolkit.scad>
Sledgehammer2d(70, 50);




Module: Sledgehammer2dOutline()

Description:

An outline of a 2d crossbow shape.

Arguments:

By Position What it does
length length of the cross bpw.
width width of the cross bow
handle_width width of the handle bit (default width/4)
head_lenght length of the head (default length/3.5)
rounding_head rounding amoubnt on the head (default 2)
rounding_handle rounding amount on the handle (default 1)
line_width width of the lione (default 1)
strap_width width of the strap outline(default line_width*4)

Example 1:

Sledgehammer2dOutline() Example 1
include <boardgame_toolkit.scad>
Sledgehammer2dOutline(70, 50);




Module: Shoe2d()

Description:

An nice 2d shoe shape.

Arguments:

By Position What it does
size size of the shoe
leg_length length of the leg bit of the shoe (default size/3)
sole_height height of the sole base of the shoe (default size/20)
base_width height of the base part of the shoe (default size/3)

Example 1:

Shoe2d() Example 1
include <boardgame_toolkit.scad>
Shoe2d(50);




Module: Shoe2dOutline()

Description:

An nice 2d shoe outline shape.

Arguments:

By Position What it does
size size of the shoe
leg_length length of the leg bit of the shoe (default size/3)
sole_height height of the sole base of the shoe (default size/20)
base_width height of the base part of the shoe (default size/3)
line_width width of the outline line (default 1)

Example 1:

Shoe2dOutline() Example 1
include <boardgame_toolkit.scad>
Shoe2dOutline(50);




Module: Bag2d()

Description:

An nice 2d bag shape.

Arguments:

By Position What it does
size size of the bag
base_round_diameter round diameter of the base circles (default size/4)
main_round_diameter round diameter of the middle bulge bit (default size/2)
neck_width width of the neck of the bag (default size/6)
rope_length length of the rope (default size/4)

Example 1:

Bag2d() Example 1
include <boardgame_toolkit.scad>
Bag2d(50);




Module: Bag2dOutline()

Description:

An nice 2d bag outline shape.

Arguments:

By Position What it does
size size of the bag
base_round_diameter round diameter of the base circles (default size/4)
main_round_diameter round diameter of the middle bulge bit (default size/2)
neck_width width of the neck of the bag (default size/6)
line_width width of the line to use for the outline

Example 1:

Bag2dOutline() Example 1
include <boardgame_toolkit.scad>
Bag2d(50);




Module: Torch2d()

Description:

An nice 2d torch shape.

Arguments:

By Position What it does
size size of the torch
handle_width the width of the handle (default width/2)
head_length length of the head (default length/7)

Example 1:

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




Module: Torch2dOutline()

Description:

An nice 2d torch outline shape.

Arguments:

By Position What it does
size size of the torch
handle_width the width of the handle (default width/2)
head_length length of the head (default length/7)
line_width width of the line (default 1)

Example 1:

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




Module: Teapot2d()

Description:

An nice 2d teapor shape.

Arguments:

By Position What it does
length length of the teapot
width width of the teapot
top_width top width of the teapot (default width*6/10)
top_length length to the top part of the teapot.
top_circle_diameter circle of the top part of the teapot
handle_rounding rounding amount to use int he top handle
handle_width width of the top handle
spout_length length of the spout
side_handle_length length of the side handle
side_handle_rounding rounding of the bottom part of the handle

Example 1:

Teapot2d() Example 1
include <boardgame_toolkit.scad>
Teapot2d(100, 70);




Module: Coin2d()

Description:

A simple coin icon to use in things.

Arguments:

By Position What it does
size the size of the coin
text text to put in the coin (default 1)
text_size size of the text to use (dewfault size/2)

Example 1:

Coin2d() Example 1
include <boardgame_toolkit.scad>
Coin2d(50);



Example 2:

Coin2d() Example 2
include <boardgame_toolkit.scad>
Coin2d(50, text = "5");




Module: CoinPile2d()

Description:

Makes a coin pile to use in other places.

Arguments:

By Position What it does
size size of the pile
coin_num number of coins in the pile (default 5)
rounding how much to round the coins (default (size * 3 / 4) / (calc_coin_num * 2))

Example 1:

CoinPile2d() Example 1
include <boardgame_toolkit.scad>
CoinPile2d(50);



Example 2:

CoinPile2d() Example 2
include <boardgame_toolkit.scad>
CoinPile2d(50, coin_num=3);



Example 3:

CoinPile2d() Example 3
include <boardgame_toolkit.scad>
CoinPile2d(50, coin_num=10);




Constant: australia_map_length

Description:

The length of the australian svg map


Constant: australia_map_width

Description:

The width of the australian svg map


Function: AustraliaMapWidth()

Description:

Works out the width of the map from the length.


Module: AustraliaMap2d()

Description:

a map of australia

Arguments:

By Position What it does
length length of the map

Example 1:

AustraliaMap2d() Example 1
include <boardgame_toolkit.scad>
AustraliaMap2d(100);




Module: Rock2d()

Description:

Makes a rock shape to use in walls and things.

Arguments:

By Position What it does
width width of the rock
length length of the rock
rounding rounding on the edge of the rock (default min(width,lenght)/5)

Constant: ruins_2d_length

Description:

The length of the ruins svg


Constant: ruins_2d_width

Description:

The length of the ruins svg


Function: Ruins2dWidth()

Description:

Works out the width of the map from the length.


Module: Ruins2d()

Description:

Makes a small ruins image to use in stuff.

Example 1:

Ruins2d() Example 1
include <boardgame_toolkit.scad>
Ruins2d(50);




Module: RockWall2d()

Description:

Makes a nice rock wall

Arguments:

By Position What it does
size size of the rock wall
num_rows number of rows (default 10)
num_cols numer of cols (default 40)

Example 1:

RockWall2d() Example 1
include <boardgame_toolkit.scad>
RockWall2d(50);




Module: D20Outline2d()

Description:

Makes a nice d20 outline for some dice.

Arguments:

By Position What it does
size size of the die image
offset the size of the walls

Example 1:

D20Outline2d() Example 1
include <boardgame_toolkit.scad>
D20Outline2d(10, 0.5);




Module: SawBlade2d()

Description:

Makes a nice 2d saw blade.

Arguments:

By Position What it does
size size of the saw blade
inner_spindle_size size of the inside spindle (default size/10)

Example 1:

SawBlade2d() Example 1
include <boardgame_toolkit.scad>
SawBlade2d(50);




Module: SawBlade2dOutline()

Description:

Makes a nice 2d saw blade.

Arguments:

By Position What it does
size size of the saw blade
inner_spindle_size size of the inside spindle (default size/10)

Example 1:

SawBlade2dOutline() Example 1
include <boardgame_toolkit.scad>
SawBlade2d(50);




Module: HalfEye2d()

Description:

Makes a single eye for use in various things where eyes are needed. This is a half eye on an angle.

Arguments:

By Position What it does
angle angle the eye is on
outer_size size of the outside circle.
inner_size size of the inside circle
pupil_size size of the pupil

Example 1:

HalfEye2d() Example 1
include <boardgame_toolkit.scad>
HalfEye2d(30);



Example 2:

HalfEye2d() Example 2
include <boardgame_toolkit.scad>
HalfEye2d(60);




Module: SideEye2d()

Description:

Makes a single eye for use in various things where eyes are needed. This is a half eye on an angle.

Arguments:

By Position What it does
angle angle the pupil is at
outer_size size of the outside circle.
inner_size size of the inside circle
pupil_size size of the pupil

Example 1:

SideEye2d() Example 1
include <boardgame_toolkit.scad>
SideEye2d(30);



Example 2:

SideEye2d() Example 2
include <boardgame_toolkit.scad>
SideEye2d(90);




Module: CloudShape2d()

Description:

Makes a cloud object. This object was made by Twanne on thingiverse: https://www.thingiverse.com/thing:641665/files

Arguments:

By Position What it does
width The width of the cloud. This also determine the height, because the height is half the width.
height Height of the object.
line_width width of the outside line (0 if no line)

Example 1:

CloudShape2d() Example 1
include <boardgame_toolkit.scad>
CloudShape2d(100);




Module: ShapeByType()

Description:

Creates shapes by a specific type to use in the lids. This is pulled out so the shape creation layout are handled independantly.

Example 1:

ShapeByType() Example 1
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_DENSE_HEX, shape_thickness = 2, shape_width = 10);

Example 2:

ShapeByType() Example 2
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_DENSE_HEX, shape_thickness = 1, shape_width = 14);

Example 3:

ShapeByType() Example 3
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_DENSE_HEX, shape_thickness = 1, shape_width = 11);

Example 4:

ShapeByType() Example 4
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_DENSE_TRIANGLE, shape_thickness = 2, shape_width = 10);

Example 5:

ShapeByType() Example 5
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_CIRCLE, shape_thickness = 2, shape_width = 14);

Example 6:

ShapeByType() Example 6
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_TRIANGLE, shape_thickness = 2, shape_width = 10);

Example 7:

ShapeByType() Example 7
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_HEX, shape_thickness = 1, shape_width = 14);

Example 8:

ShapeByType() Example 8
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_OCTOGON, shape_thickness = 1, shape_width = 16);

Example 9:

ShapeByType() Example 9
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_OCTOGON, shape_thickness = 1, shape_width = 13, shape_aspect_ratio=1.25);

Example 10:

ShapeByType() Example 10
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_OCTOGON, shape_thickness = 1, shape_width = 10.5, shape_aspect_ratio=1);

Example 11:

ShapeByType() Example 11
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_SQUARE, shape_thickness = 2, shape_width = 11);

Example 12:

ShapeByType() Example 12
include <boardgame_toolkit.scad>
default_lid_shape_rounding = 3;
ShapeByType(shape_type= SHAPE_TYPE_SQUARE, shape_thickness = 2, shape_width = 11);

Example 13:

ShapeByType() Example 13
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_CLOUD, shape_thickness = 2, shape_width = 11);

Example 14:

ShapeByType() Example 14
include <boardgame_toolkit.scad>
ShapeByType(shape_type = SHAPE_TYPE_SUPERSHAPE, shape_thickness = 2);

Example 15:

ShapeByType() Example 15
include <boardgame_toolkit.scad>
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);

Clone this wiki locally