Exit Full View
ZipUp

/Furniture/PlyBuild.foocad

PlyBuild

Can I create for building cabinets and other furniture, which requires only the most basic skills (such as cutting straight lines in plywood and drilling holes), and only common materials available at every hardware store?

Tools Required

Drill Drill bits Screwdriver 3D Printer A4 2D Printer Saw for cutting plywood sheets.

FooCAD Source Code
import uk.co.nickthecoder.foocad.smartextrusion.v1.*
import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.*

class PlyBuild : Model {

    @Custom
    var holeDiameter = 10

    @Custom( about="Width and height of piece `holeShim`'s cap.")
    var holeOverlap = Vector2( 3.0, 1.0 )

    @Custom
    var plyThickness = 10

    @Custom
    var holeClearance = 0.2

    @Custom
    var holeShimThickness = 1.8

    @Custom( about="The hole in piece `holeShim` is offset from center to correct for inacuracy of a drilled hole" )
    var holeError = 0.5

    
    val PLY = "Tan"
    val HOLE_SHIM = "Orange"

    @Piece
    meth holeShim() = holeShim( plyThickness, holeError )
    
    @Piece
    meth holeShimHalf() = holeShim( plyThickness/2 - 0.5, holeError )

    meth holeShim( depth : double, error : double ) : Shape3d {
        val od = holeDiameter - holeClearance

        val cover = Circle( holeDiameter/2 + holeOverlap.x )
            .smartExtrude( holeOverlap.y )
                .bottom( Chamfer( 0.5 ) )

        val shaft = Circle( od/2 )
            .smartExtrude( depth )
                .top( Chamfer( 0.5 ) )
            .bottomTo( cover.top )

        val hole = Circle( od/2 - holeShimThickness )
            .translateX( error )
            .smartExtrude( shaft.top + 0.02 )
            .bottomTo( -0.01 )

        return cover + shaft - hole
    }


    @Piece
    meth example1() : Shape3d {
        val holeOffset = plyThickness + holeDiameter/2 - holeShimThickness
        val size = Vector3( 100, 100, 50 )

        val holes = Circle( holeDiameter/2 )
            .translate( size.x/2 - holeOffset, size.y/2 - holeOffset )
            .mirrorX().also().mirrorY().also()

        val base = (
            Square( 100, 100 ).center() - holes
        ).extrude( plyThickness ).color(PLY)

        val back = Square( 100, 50 ).centerX()
            .extrude( plyThickness ).color(PLY).darker()
            .rotateX(90)
            .bottomTo( base.top )
            .backTo( base.back )

        val shims = holeShim().topTo(base.top)
            .translate( size.x/2 - holeOffset, size.y/2 - holeOffset, 0 )
            .mirrorX().also().mirrorY().also()
            .color( HOLE_SHIM )

        return base + shims + back
    }

    override fun build() : Shape3d {
        return holeShim()
    }

}