Exit Full View
Up

/Hardware/SlatFixture2.foocad

SlatFixture2

I often want a batton to support a floor or shelf, but I can't be bothered to make "proper" woodworking joints. These are a quick and simple way to attach the battons, such that the battons can be removed without unscrewing anything.

FooCAD Source Code
import static uk.co.nickthecoder.foocad.screws.v1.Screws.*

class SlatFixture2 : Model {
    
    @Custom( about="Thickness and width of the wood used for the slats (include extra for play)" )
    var slatSize = Vector2( 20, 30 )

    @Custom( about="A layer of plastic that the end grain touches. May be zero." )
    var baseThickness = 3.0

    @Custom
    var thickness = Vector2( 4, 16 )

    @Custom( about = "The diameter of the hole for the screw" )
    var screwD = 3

    @Custom( about = "The diameter of the countersink for the screws" )
    var headD = 8

    override fun build() : Shape3d {
        val chamfer = thickness.x
        val outer = 
            Square( slatSize.x + thickness.x*2, slatSize.y + thickness.x ).centerX()
                .roundCorner( 1, chamfer ).roundCorner(0, chamfer)
        val profile = outer -
            Square( slatSize ).centerX().translateY( thickness.x + 0.01 )

        val base = outer.extrude( baseThickness )

        val main = profile.extrude( thickness.y )
        val hole = countersink( screwD, headD )
            .topTo(baseThickness+0.01)
            .backTo( outer.back - 3 )
            .frontTo( outer.front + thickness.x + 3 ).also()
        
        val angle = Degrees.atan( main.size.z*0.7 / main.size.y )
        val slope = Cube( main.size.x + 1, main.size.y * 2, main.size.z * 2)
            .centerX().rotateX(-angle).translateZ( main.top )


        return base + main - slope - hole
    }
}