FooCAD Source Codeimport static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*
class SpinningTurtles : Model {
@Custom
var size = Vector3( 80, 20, 15 )
@Custom
var pegSize = Vector2( 6, 10 )
@Custom
var turtleSize = Vector3( 30, 20, 7 )
@Piece
fun base() : Shape3d {
val top = Circle( 50 ).scale(1/100).scaleX(size.x).scaleY(size.y)
.extrude( size.z * 0.1 )
val partSphere = ( Sphere(50).translateZ(-5) intersection Cube( 200 ).centerXY() )
.scale(1/100).scale(size)
.bottomTo( top.top )
val holes = Circle( pegSize.x/2+0.3 ).chamferedExtrude(pegSize.y/2, -1, 0)
.bottomTo(-0.1)
.translateX( size.x * 0.25 )
.mirrorX().also()
return partSphere + top - holes
}
@Piece
fun turtle() : Shape3d {
val hemiSphere = Sphere( 50 ) intersection Cube( 200 ).centerXY()
val shell = hemiSphere.scale( 1/100 ).scale( turtleSize ).scaleZ(2)
.translateX(turtleSize.x* 0.2)
val hole = Circle( pegSize.x/2+0.15 ).chamferedExtrude(pegSize.y/2, -1, 0)
.bottomTo(-0.1)
return shell - hole
}
@Piece
fun peg() : Shape3d {
return Cylinder( pegSize.y, pegSize.x/2 )
}
override fun build() : Shape3d {
val base = base().mirrorZ().bottomTo(0)
val pegs = peg()
.translateX( base.size.x * 0.25 )
.mirrorX().also()
.bottomTo( base.top + 5 )
.color("Orange")
val turtle = turtle()
.translateX( base.size.x * 0.25 )
.bottomTo( pegs.top + 5 )
return base + pegs + turtle
}
}