Exit Full View
Up

/Garden/PotStakeClip.foocad

PotStakeClip

If you need to stake a tall plant in a pot of compost, the compost is often too loose and fluffy to support the stake. So I want to fasten a canehorizontally across the top of the pot, and fasten another cane to it, vertically.

Use two "otherClip"s to fasten the horizontal cane to the pot (otherD is the thickness of the pot's rim) And use two "clip"s glued at right angles to fasten the vertical cane to the horizontal cane.

Print Notes

Use a brim

FooCAD Source Code
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*

class PotStakeClip : Model {
    
    @Custom( about = "The internal diameter of the clip" )
    var clipD = 10

    @Custom( about = "The thickness of the clip" )
    var thickness = 3

    // When gluing pairs of clips together, keep this the same for both halves.
    @Custom( about = "The height of the clip and the size of the square of the single clips" )
    var baseSize = 12

    @Custom( about = "Only used by otherDoubleClip. The internal diameter of the 2nd clip" )
    var otherD = 12

    @Custom( about= "The angle of the base" )
    var angle = 0

    fun simpleClip(diameter : double) : Shape3d {
        val chamfer = thickness * 0.2
        val d = diameter + thickness/2
        val foo = 1.0
        val bar = 0.6
        val path = PolygonBuilder().apply {
            moveTo(0, 0)
            circularArcBy( 0, -d*bar, d*foo, false, false )
            circularArcBy( d * 0.8, 0, d/2, true, true )
            circularArcBy( 0,  d * bar, d*foo, false, false )
        }.buildPath()
            .scaleY(1.2)

        val a = path.thickness( thickness )
            .roundAllCorners(1)
            .frontTo( -d/2*1.2 - thickness/2)
            //.frontTo(chamfer)
            .centerX()


        val clip = a.chamferedExtrude( baseSize, chamfer )

        return clip
    }

    fun clipWithBase(diameter: double) : Shape3d {
        val chamfer = thickness * 0.2
        val clip = simpleClip( diameter )

        val base = Square( baseSize ).roundAllCorners(chamfer)
            .chamferedExtrude( thickness, 0, chamfer )
            .rotateX(90).centerX()
            .translateY(-diameter/2 * 1.2)
            .rotateZ( angle )


        return clip + base
    }



    @Piece
    fun clip() = clipWithBase(clipD)


    @Piece
    fun otherClip() = clipWithBase( otherD )

    @Piece
    fun doubleClip() : Shape3d {
        val clip = simpleClip( clipD ).frontTo(0)

        return clip.translateY(-thickness/2).mirrorY().also()
    }

    @Piece
    fun otherDoubleClip() : Shape3d {
        val a = simpleClip( clipD ).frontTo(-thickness/2)
        val b = simpleClip( otherD ).frontTo(-thickness/2)
        return a + b.mirrorY()
    }

    override fun build() : Shape3d {
        val half = clip().centerZ().frontTo(0).color("Orange")
        val other = otherClip().centerZ().frontTo(0).color("Green")

        val a = half + half.mirrorY().rotateY(90).darker()
        val b = half + other.mirrorY().rotateY(90)

        return a + b.leftTo(20) + doubleClip().leftTo(50) + otherDoubleClip().leftTo(80)
    }
}