import uk.co.nickthecoder.foocad.extras.v1.* import static uk.co.nickthecoder.foocad.extras.v1.Extras.* class SnailCrusher : Model { var size = Vector3( 50, 60, 40 ) var thickness = 3 var clearance = 0.2 meth slotShape() : Shape2d { val tri = Triangle( size.y / 2 - thickness*2 ) .frontTo( -size.y/2 + thickness * 2 ) val triScaled = tri.scaleX( (size.x - thickness*3) / tri.size.x ) .roundAllCorners(3) return triScaled.mirrorY().also() } meth main() : Shape3d { val outside = Cube( size ) .centerXY().translateX(-thickness/2-clearance/2) val inside = Cube( size - Vector3( thickness, thickness*2, thickness*2 ) ) .rightTo( outside.right + 0.01 ) .centerY() .centerZTo( outside.middle.z ) val slot = slotShape().extrude( thickness + 2 ) .topTo( outside.top + 1 ) return outside - inside - slot } meth plate() : Shape3d { val plate = Square( size.x - thickness*2 - clearance*2, size.y - thickness*2 - clearance*2 ).center() .extrude( thickness ) return plate } override meth build() : Shape3d { val main = main() val plate = plate() .bottomTo( main.top - thickness*2 - clearance ) .color("Green") return main + plate } }