Exit Full View
Up

/Misc/KeyCover.foocad

KeyCover
FooCAD Source Code
/*
    Color code your keys, to make it easy to pick the right key.

    Print many covers, each colour coordinated with the door colour.
    If all you doors are the same colour, paint them ;-P

Print Notes

    Use a brim, as there is very little bed contact without a brim.
    Use high number of perimeters, as we don't want any infill, but do want it solid.

*/
class KeyCover : Model {

    var keyD = 23.0
    var keyT = 2.5
    var thickness = 1.0
    var holeOffset = 5.0
    var holeD = 6.0
    
    override fun build() : Shape3d {
        val profile = Circle( keyD/2 + thickness ) /
            Square( keyD+thickness*2, keyD *0.8 ).centerX().frontTo(-keyD *0.2)

        val main = profile.extrude( keyT + thickness*2 ) -
            Cylinder( keyT, keyD/2 ).bottomTo( thickness ) -
            Cube( keyD, keyD, keyT ).centerX().backTo(0).bottomTo( thickness )

        val hole = Cylinder( 20, holeD/2 ).center().translateY( holeOffset )

        val result = main - hole
        return result.rotateX(90).translateZ(keyD*0.2)
    }
}