Exit Full View
Up

/Util/HoleTrim.foocad

HoleTrim
FooCAD Source Code
/**
    Plastic trim to neaten up holes cut wood.
    To neated both sides of the wood, print 2 pieces, and make trimSize.y
    slightly less than the wood's thickness.
*/
class HoleTrim : Model {

    
    @Custom( about="Diameter of the hole. ")
    var holeDiameter = 15.0

    @Custom( about="Thickness and depth of the trim" )
    var trimSize = Vector2( 1, 8 )

    @Custom( about="How much larger is the trim than the hole" )
    var overlap = 2

    @Custom( about="Ensures the plastic fits in the hole" )
    var slack = 0.3

    override fun build() : Shape3d {
        val r = holeDiameter/ 2 - 0.3
        val neck = (Circle( r ) - Circle( r - trimSize.x))
            .extrude( trimSize.x + trimSize.y )
        
        val flat = (Circle( r + overlap ) - Circle( r ))
            .extrude( trimSize.x )

        return neck + flat
    }
}