FooCAD Source Codeimport uk.co.nickthecoder.foocad.smartextrusion.v1.*
import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.*
class NigerSeedFeederBase : Model {
@Custom
var diameter = 62.0
@Custom
var feedHeight = 20
@Custom( about="Diameter of the hole for the perch. The perch is printed slightly smaller." )
var perchDiameter = 5.0
@Custom
var perchHeight = 5
@Custom
var perchHeight2 = 10
@Custom
var baseSize = Vector2(5, 6)
@Piece( about="A quick test piece to dial-in the 'diameter'" )
meth testBase() : Shape3d {
val c= Circle( diameter/2 )
return (c - c.offset(-3)).extrude(1)
}
@Piece
meth base() : Shape3d {
val base = Circle( (diameter / 2) + baseSize.x )
.smartExtrude(baseSize.y)
.top( Fillet(baseSize.x-0.5) )
val main = Circle( diameter/2 )
.smartExtrude( feedHeight + diameter/2 )
.bottomTo( base.top )
val slope = Sphere( diameter/2 )
.scaleY(1.7).scaleX(1.3)
.translateZ( main.top )
.translateX( diameter/2 )
.mirrorX().also()
val perchHole = Cylinder( diameter, perchDiameter/2 )
.rotateY(90)
.centerX()
.centerZTo( base.top + perchHeight )
.centerZTo( base.top + perchHeight2 ).rotateZ(30).also(2)
return base + main - slope - perchHole
}
@Piece
meth perch() : Shape3d {
val cyl = Circle( perchDiameter/2 - 0.2 ).extrude( 120 )
.rotateY(90).centerX()
.bottomTo(-0.6)
val main = cyl.intersection( Cube( 200 ).centerXY() )
val ears = Circle(8).extrude(0.4).centerXTo( main.right ).mirrorX().also()
return main + ears
}
override fun build() : Shape3d {
return base() + perch().topTo( baseSize.y + perchHeight+perchDiameter*0.5 ).previewOnly()
}
}