Exit Full View
Up

/GardenFurniture/MiniShed.foocad

MiniShed
FooCAD Source Code
import static uk.co.nickthecoder.foocad.along.v2.Along.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*

/*
    I want to build a mini shed for long gardening tools, wuch as hoes, spades etc.
    As well as the annoyingly shaped pick axe!
    Each tool should be easy to get out, so probably on its own hook.
        I don't care if the pick axe and hammer are harder to get to, as they are rarely used.
    Being heavy, the pick ax and large hammer can rest on the floor??

    Maybe one side of the shed has shelves, so the long items only live in one half??
    Is it high enough for two spades high?

    Could add other tools, such as saws.
    
    Do I want to get to the gate? I could build a second one which sits in front of the gate,
    and has a "stable" door, where the top part opens without the bottom part.

    Build the two sides, then attach the back pieces and front timbers to form the final shape.
    The roof structure an fit "over" the main part, and then screwed in from the sides
        This gives it natural overhang.
        Plywood and roofing felt finishes it off. Can be any ply, even thin stuff, as it can be nailed
        at the sides pieces only??? (and where there are ribs if needed in the middle)
            There will be no overlap, as the roof is small???
    The pitch of the roof isn't important. Can't match the shed, as it will be further back than the shed.

    Sides and back can be feather edge.
    Doors could be similar to the shed??? (Or more feather edge, but constructed like a shed door?)

*/

class MiniShed : Model {
    
    @Custom
    var width = 1200

    @Custom
    var height = 1800

    @Custom
    var depth = 600

    @Custom
    var angle = 30.0

    @Custom
    val roofExtra = 60

    @Custom
    var single = false

    // Half of 45x70 C16 grade from Wickes?
    @Custom 
    var support = Lumber( "Support" ,45, 32 ).stockLength(2400)

    // Lumber
    @Custom
    var thin = Lumber("Thin", 45, 32 ).stockLength(2400) 
    
   
    override fun build() : Shape3d {
        val backHeight = height - depth * Degrees.tan(angle)

        val backUp = support.cut( backHeight )
            .color( "Orange" )
            .label( "backUp" )
            .translateX(-width/2)
            .translateY( depth - support.thickness() )
            .mirrorX().also()

        val frontUp = support.cut( height )
            .color("Orange")
            .label( "frontUp" )
            .translateX(-width/2)
            .mirrorX().also()

        val sideSupps = support.cut( depth - support.thickness()*2 )
            .color( "Blue" )
            .label( "sideSupp" )
            .alongY()
            .translateX(-width/2)
            .translateY(support.thickness())
            .mirrorX().also()
            .spreadZ( 3, backHeight - 300 ).bottomTo(80)

        val fronts = support.cut( width - support.width()*2 )
            .color( "Green" )
            .label( "front" )
            .alongX2().bottomTo(0)
            .centerX()
            .spreadZ( 2, height-40 )

        val backs = support.cut( width - support.width()*2 )
            .color( "Green" )
            .label( "back" )
            .alongX2().bottomTo(0)
            .centerX()
            .translateY( depth - support.thickness() )
            .spreadZ( 4, backHeight )

        val roofLong = thin.cut( width + 60 )
            .color( "Yellow" )
            .label( "roofLong" )
            .alongX2().bottomTo(0).centerX()
            .translateY( (depth  + roofExtra)/ Degrees.cos(angle) ).also()
            
        val roofShort = thin.cut( (depth + roofExtra) / Degrees.cos(angle) - thin.thickness() )
            .color( "Yellow" ).darker()
            .label( "roofShort" )
            .alongY().translateY(thin.thickness())
            .spreadX( 4, width + 60 )
            .centerX()


        val roof = (roofLong + roofShort)
            .translateY(-support.thickness-thin.thickness-roofExtra*0.125)
            .rotateX( -angle )
            .translateZ( height )

        val slackX = 10
        val doorSlack = 10
        val doorWidth = if (single) width/1 else width/2 - slackX

        val doorLong = thin.cut( height - doorSlack )
            .color("Purple")
            .label( "doorLong" )
            .spreadX( 2, doorWidth )
            .translateX(10)
            .mirrorY()

        val doorShort = thin.cut( doorWidth - thin.width()*2 )
            .color("Purple").brighter()
            .label( "doorShort" )
            .alongX2().bottomTo(0)
            .mirrorY()
            .translateX(slackX+thin.width())
            .spreadZ( 4, height - doorSlack )
            

        val door = (doorLong + doorShort)

        val doors = if (single) {
            door.centerX()
        } else {
             door.mirrorX().also()
        }

        return backUp + frontUp + sideSupps + fronts + backs + roof +
           doors

    }
}