Exit Full View
Up

/Garden/LEDGroundSpike.foocad

LEDGroundSpike

I converted some garden LED lights so that they are powered by 12V DC as well as dimly lit via solar panels. I needed to replace the spike with one that allows the wires to enter.

Don't use PLA, as it will soften and buckle in the sun!

Hmm, not a very good design, because when printed upright, it is weakest exactly where it needs to be strong!

FooCAD Source Code

class LEDGroundSpike : Model {

    @Custom
    var length = 100

    var diameter = 20.5
    var height = 20

    @Custom( about="This is the weakest part, so not too thin!" )
    var topT = 4

    @Custom( about="Thickness of the blades of the spike. Doesn't need to be as thick as topT" )
    var spikeT = 2.4
    
    fun cross( size : double ) = Square( size, spikeT ).center().rotate(90).also()

    override fun build() : Shape3d {
    
        var top = ExtrusionBuilder().apply {
            crossSection( Circle( diameter/2 ) )
            forward( height )
            crossSection()
            forward(1)
            crossSection(1)
            forward(1)
            crossSection()
            forward(diameter)
            crossSection( -diameter/2 )
        }.build()

        val point = ExtrusionBuilder().apply {
            crossSection( cross(diameter) )
            forward( length - diameter * 2 )
            crossSection()
            forward( diameter*2 )
            crossSection( cross(spikeT+0.1) )
            forward(spikeT*2)
            crossSection( Square(0.001) )
        }.build().bottomTo( height + 2 )


        val hole = Cube( diameter, diameter, height+diameter+2 )
            .translate(spikeT/2,spikeT/2,0)
            .rotateZ(180).also()

        val coreD = diameter - topT * 2
        val core = Cylinder( height + 5, coreD/2 )  +
            Cylinder( diameter-topT*2, coreD/2, 0 ).bottomTo( height + 5 ) 

        val brim = Cylinder( 0.2, 20 )

        return top + point - hole - core + brim
    }
}