# Making Our First Box

`# box.pyimport solid# Size for our boxlength, width, height = 100, 150, 50# Wall thicknesswall = 3box = solid.cube(size=[length, width, height])# Inner box needs to be smaller based on the wall sizeinside = solid.cube(    size=[length - 2 * wall, width - 2 * wall, height - wall])# Offset inner boxinside = solid.translate([wall, wall, wall])(inside)# Remove inner box from the outer to create the empty spacebox += solid.hole()(inside)solid.scad_render_to_file(box, "box.scad", include_orig_code=False)`
`# Make sure you have SolidPython installed\$ python -m pip install solidpython# Run the above script saved as box.py\$ python box.py# Convert scad to stl\$ openscad -o box.stl box.scad`
`# box.py (continued)def roundbox(size, radius):    """Box with rounded edges."""    x, y, z = size    # Adjust the box size to maintain the original dimensions    x = x - radius * 2    y = y - radius * 2    z = z - 1    return solid.minkowski()(        solid.cube(size=[x, y, z]),        solid.cylinder(r=radius),    )`

# Creating the Burgle Bros Insert

`# box.py (continued)wall = 3# Tokens holderx, y, z = 171, 60, 15box = roundbox([x, y, z], radius=2)# Make 4 equal size wellswells = 4size = (x - (wells + 1) * wall) / wellswell = roundbox([size, y - wall * 2, z - wall], radius=2)for i in range(wells):    box += solid.hole()(solid.translate(        [wall * (i + 1) + size * i, wall, wall])(well))# Output box to SCAD filesolid.scad_render_to_file(    box, "tokens.scad", include_orig_code=False)# Character, guards and dice holderx, y, z = 171, 60, 15box = roundbox([x, y, z], radius=2)# Character holder (77 mm)characters = roundbox([77, y - wall * 2, z - wall], radius=2)box += solid.hole()(solid.translate([wall, wall, wall])(characters))# Guard holder (52 mm)guards = roundbox([52, y - wall * 2, z - wall], radius=2)box += solid.hole()(solid.translate(    [wall * 2 + 77, wall, wall])(guards))# Dice holder (30 mm)dice = roundbox([30, y - wall * 2, z - wall], radius=2)box += solid.hole()(solid.translate(    [wall * 3 + 77 + 52, wall, wall])(dice))# Output box to SCAD filesolid.scad_render_to_file(    box, "characters.scad", include_orig_code=False)`
`# Run the above script saved as box.py\$ python box.py# Convert scad to stl\$ openscad -o tokens.stl tokens.scad\$ openscad -o characters.stl characters.scad`

--

--

## More from The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +768K followers.