FooCAD Source Codeimport static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*
/**
Feet to lift a plant pot off the ground, to help drainage.
Print Notes
Use many perimeters, and large fill density to support heavy pots.
*/
class PlantPotFeet : Model {
@Custom( about="Pick which profile from the SVG file to use" )
var profile = 1
@Custom( about="Determines the slight curve of the foot. Does not need to be exact" )
var potDiameter = 200
@Custom( about="The length of the foot. Used to scale the profile" )
var length = 30
@Custom( about="The width of the foot" )
var width = 20
@Custom( about="If true, then use a simple extrusion, rather than revolve" )
var extrude = false
// Using the Tile extension is tricky, because the bounding box doesn't fit well around the
// revolved shape. I should try to fix this problem in foocad!
@Custom( about="How many feet to print at a time. Default is 3" )
var quantity=3
fun profile() : Shape2d {
val result = SVGParser().parseFile( "PlantPotFeet.svg" ).shapes["profile$profile"].toOrigin()
return result.scale( length / result.size.x )
}
override fun build() : Shape3d {
val profile = profile()
return if (extrude) {
val one = profile.extrude(width)
one.tileY( quantity, 1 )
} else {
var angle = 2*Degrees.atan(width/2/potDiameter)
val one = profile.leftTo(potDiameter/2).revolve( angle ).sides(8)
one.repeatAroundZ(quantity,angle+1).translateX(-potDiameter/2)
}
}
}