import uk.co.nickthecoder.foocad.cup.v1.* import static uk.co.nickthecoder.foocad.cup.v1.Cup.* import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* import uk.co.nickthecoder.foocad.extras.v1.* import static uk.co.nickthecoder.foocad.extras.v1.Extras.* class VegTray : Model { var size = Vector3( 200, 230, 80 ) var thickness = 1.2 var baseThickness = 1.8 var shortSide = 70 meth fullShape() : Shape2d { return ( Square( size.x, shortSide ) + Triangle( size.x, size.y - shortSide ).mirrorX().mirrorY().leftTo(0) ).centerX() } meth smallShape() = fullShape() - Square( 500 ).centerY().leftTo(-4) meth largeShape() = fullShape() - Square( 500 ).centerY().rightTo(4) @Piece meth small() = tray( smallShape() ) @Piece meth large() = tray( largeShape() ) meth tray( shape : Shape2d ) : Shape3d { val step = ProfileEdge.chamferedStep( 3, 10 ).reverse() val main = shape.toPolygon().roundAllCorners(5) .cup(size.z, thickness) .baseThickness( baseThickness ) .insideBottom( Fillet( 10 ) ) .outsideBottom( roundedChamfer( 8 ) ) .outsideTop( step ) .insideTop( Fillet(2) ) // Wasn't included in the first printed version. return main } override fun build() : Shape3d { return small() + large() } }