import static uk.co.nickthecoder.foocad.along.v2.Along.* import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* include General.foocad /* A planter, which never rots, because the plants are placed in plastic containers which are hidden from view by the light green trim. I use these in front of my house, and swapping the plastic containers let's me freshen the display without digging up the old display. So for example a display of spring flowering bulb can be replaced by geranimums. The bulbs can be placed elsewhere until their foliage dies down. */ class Planter : General() { // Timber is either 1.8m or 2.4m. // I want to fit TWO 600mm boxes, so the length must be over 1200mm, // so the 2.4m timber is no good. // 1.8m timber leaves 500mm, which is just about perfect (for the width W) val length = 1455 val width = 440 val trimW = 30 val trimT = 18 val dividerW = 50 val dividerT = 35 val ringCount = 3 val dividerCount = 2 fun height() = (ww + gap) * ringCount - gap fun trimLumber() = Lumber( "trim", trimW, trimT, "LightGreen" ) fun dividerLumber() = Lumber( "divider", dividerW, dividerT, "LightGreen" ) fun trim() : Shape3d { val lumber = trimLumber() val edge = lumber.cut( length - wt * 2 ) //.cutZRatio( MitreJoint( lumber, 3 ), 0 ) //.cutZRatio( MitreJoint( lumber, 3 ).otherEnd(), 1 ) .rotate(0,0,90).alongX() .translate( -length/2 + wt, -width/2+wt, height() - trimT ) val end = lumber.cut( width - wt * 2 ) //.cutZRatio( MitreJoint( lumber, 3 ), 0 ) //.cutZRatio( MitreJoint( lumber, 3 ).otherEnd(), 1 ) .alongY2() .translate( -length/2 + wt, -width/2+wt, height() - trimT ) return edge + edge.mirrorY().also() + end.mirrorX().also().brighter() } fun divider() : Shape3d { val lumber = dividerLumber() return lumber.cut( width - wt * 2 ) //.cutZRatio( MitreJoint( lumber, 0 ).translate(0,-trimT,0), 0 ) //.cutZRatio( LapJoint( lumber, 1 ).translate(0,-trimT,0), 0 ) .alongY2() .translate( 0, -width/2+wt, height() - trimT ) } fun dividers() : Shape3d { return divider().spreadX( dividerCount, length, 1 ).translateX(-length/2) } override fun build() : Shape3d { return rings( lumber, length, width, gap, ringCount ) + feet( length, width ) + slattedFloor( length, width ).color("Violet") + trim().color("Orange") + dividers().color("Red") } }