/Garden/TroughSlider.foocad

Prevents platers/troughs from tipping off of the shelf supports that they rest upon.
Glue these to the underside of planters/troughs and then slide onto the shelf brackets.
import uk.co.nickthecoder.foocad.smartextrusion.v1.*
import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.*
import uk.co.nickthecoder.foocad.cup.v1.*
import static uk.co.nickthecoder.foocad.cup.v1.Cup.*
class TroughSlider : Model {
@Custom( about="X,Z = Width and thickness of the metal shelf support. Y=Size of trough's base." )
var size = Vector3( 20, 80, 4 )
var wallThickness = 2.0
var baseThickness = 0.6
var overlap = 5
var round = 6
var rimSize = 3
override fun build() : Shape3d {
val shape = Square( size.x + wallThickness*2, size.y+wallThickness + overlap + round )
.roundAllCorners(round)
.centerX() +
Circle( size.x*1.5 ).sides(4)
val cup = shape
.backTo( size.y + wallThickness )
.cup( size.z + baseThickness + wallThickness*2, wallThickness )
.baseThickness( baseThickness )
.insideTop( ProfileEdge.chamferedStep(-rimSize, rimSize*2) )
.outsideTop( ProfileEdge.chamfer(rimSize-1) )
val envelope = Cube( cup.size.x, cup.size.y, cup.size.z )
.centerX()
val extra = Square( size.x + overlap*2, size.y )
.centerX()
.translateY(-overlap)
.roundAllCorners(round)
.extrude( baseThickness )
return (cup + extra intersection envelope)
}
}