FooCAD Source Codeimport uk.co.nickthecoder.foocad.extras.v1.*
import static uk.co.nickthecoder.foocad.extras.v1.Extras.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*
class Drainer : Model {
@Custom
var width = 80
@Custom
var height = 50
@Custom
var thickness = 8
@Custom
var spacing = 16
@Custom
var tilt = 10
@Custom
var count = 10
meth single() : Shape3d {
val plain = Square( height, width )
.roundCorner( 2, height* 0.7 )
.roundCorner( 1, height* 0.7 )
.extrude( thickness*2 )
.centerY()
.rotateY(-90)
.centerX()
val foo = 200
val envelope = CircularArc( foo + thickness, foo, -25, 25 )
.translateX(-foo)
.extrude( height )
return (plain.intersection(envelope))
.rotateY(tilt)
.bottomTo(0)
}
meth rack() : Shape3d {
val uprights = single().repeatX( count, spacing + thickness )
.centerX()
val base = Square( uprights.size.x, uprights.size.y )
.extrude( thickness )
.centerXY()
return uprights + base
}
@Piece
meth halfRack() = rack().rotateX(90).intersection( Cube( 1000 ).centerXY() )
.translateY(-1)
override fun build() : Shape3d {
return rack()
}
}