Exit Full View
Up

/Kitchen/TinOpenerHandle.foocad

TinOpenerHandle
FooCAD Source Code
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*
/*
    My Tin opener handle broke, so I printed a new one.
*/
class TinOpenerHandle : Model {

    // Diameter of the spindle
    var diameter = 8.8

    // Thickness of the flat part of the spindle.
    var flat = 7.6

    // How much larger to make the hole for the spindle.
    // Tried 0.05, then 0.15, then 0.24
    var slack = 0.24

    var baseThickness = 2

    var size = Vector3( 75,18, 19 )

    var spacer = Vector2(9,0.8)
    
    var chamfer = 2

    override fun build() : Shape3d {
    

        val holeP = Circle.hole( diameter/2 + slack) / Square( 1000, flat + slack*2 ).center()
        // Taper the hole a little
        val hole = holeP.extrude( size.z, 1.1 ).translateZ(baseThickness)

        // Uncomment this to create a test piece to check for fit before printing
        // the whole part.
        // Hmm, I tested the hole, and it seemed fine, but when printed for real,
        // it didn't fit, so I needed to adjust the slack and reprint.
        //return Cylinder( size.z, diameter/2 + 2 ) - hole

        val spacerCircle = Circle( size.y /2 )
        val spacerRing = (spacerCircle - spacerCircle.offset(-spacer.y))
            .extrude( size.z + spacer.x - chamfer ).translateZ( chamfer )

        val round = 10
        val wingEnd = Circle( round/2 ).translateX( size.x/2 - round )
        val wingP = wingEnd.hull( Circle( size.y/2 ) ) +
            wingEnd.hull( wingEnd.translate(round/2,-round/4) )
            
        val wings = wingP.rotate(180).also().chamferedExtrude( size.z, chamfer )

        return wings + spacerRing - hole
    }
}