Exit Full View
Up

/House/LEDCover.foocad

LEDCover
FooCAD Source Code
import static uk.co.nickthecoder.foocad.chamferedExtrude.ChamferedExtrude.*

/**

    Designed for my COB LEDs behind my headboard, so the "missing" side doesn't matter,
    because the headboard is there, and the other side is against the wall.
    The only "important" face is the sloped top (most +ve Y during printing).

    Note, I deliberately oriented the piece this way, so that the z-layer
    imperfections will scatter the light broadly.
    Use a high-ish layer height, and your worst printer! ;-)
*/

class LEDDiffuser : Model {
    
    var width = 25    
    var height = 30
    var length = 180
    var thickness = 0.9
    var round = 5
    val tabSize = 7

    override fun build() : Shape3d {

        val profile = PolygonBuilder().apply {

            moveTo( -length /2 + tabSize, 0 )
            lineTo( -length /2, 0 )
            radius( round )
            lineTo( -length /2, height)
            lineTo(  length /2, height)
            radius( 0 )
            lineTo(  length /2, 0 )
            lineTo(  length /2 - tabSize, 0 )
        }.buildPath().thickness( thickness ).translateY(thickness/2)

       
        val main = profile.extrude( width, Vector2(1,0.75) )

        return  main -
            Cylinder( tabSize+thickness/2 + 2, 2 + tabSize, 2 )
                .rotateY(90)
                .translateX(length/2-tabSize-1).translateZ(width/2)
                .mirrorX().also() +
            Cube( length, thickness, 4 ).centerX() +
            Square( length, height )
                .roundCorner(3,round)
                .roundCorner(2,round)
                .extrude(0.4).centerX()

    }

}