Exit Full View
Up

/Garden/BorderStakes.foocad

BorderStakes
FooCAD Source Code
class BorderStakes : Model {
    
    var stakeD = 9.0

    @Custom( about="Width and thickness of the rings" )
    var ringSize = Vector2( 5, 4 )

    @Piece
    fun ring() : Shape3d {
        val ring = Circle( stakeD/2 + ringSize.x ) - Circle( stakeD/2 )
        return ring.extrude( ringSize.y )   
    }

    @Piece
    fun safetyTop() : Shape3d {
        val mainHeight = 10
        return ExtrusionBuilder().apply {
            forward( mainHeight )
            crossSection (Circle( stakeD/2 ) )
            forward( -mainHeight )
            crossSection(  )

            crossSection( Circle( stakeD/2 + ringSize.x ) )
            forward( mainHeight + ringSize.y )
            crossSection()
            forward( stakeD/2 )
            crossSection( - stakeD/2 )
            
        }.build()
    }

    override fun build() : Shape3d {
        return ring() + safetyTop()
    }
}