FooCAD Source Codeimport static uk.co.nickthecoder.foocad.extras.v1.v1.Extras.*
/**
Allows an AA battery to be used in a holder for C batteries.
*/
class BatteryAAToC : Model {
val aaDiameter = 14.2 + 1.0 // 1mm larger so it is easy to fir the battery inside.
val cDiameter = 26.0
// The length of an AA is the same as a C, which is why we only need plastic spacers to
// convert from one to the other.
val length = 46.0 - 2.0 // A little shorter than the total battery length
override fun build() : Shape3d {
val profile = Circle( cDiameter / 2 ) - Circle( aaDiameter/2 ) -
Circle( aaDiameter ).sides(3).rightTo(0)
return profile.extrude( length )
}
}