/Hardware/HoleTrim.foocad

Drill a hole in a piece of wood, and then insert this plastic trim to neaten up the hole, and prevent water from getting in.
Wood glue will hold it in place, even though wood glue doesn't stick to plastic. (due to the layer lines).
For a slot shaped hole (rather than a circle) :
Mark two points slotDistance
apart
Drill the two holes
Clean up the remainder with a chisel.
import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* import uk.co.nickthecoder.foocad.compound.v1.* class HoleTrim : Model { @Custom var drillDiameter = 10.0 @Custom var internalDiameter = 8.0 @Custom( about="For non-zero values, the result is a slot, instead of a round hole" ) var slotDistance = 0.0 @Custom var depth = 20 @Custom var clearance = 0.3 @Custom( about="Width and thickness of the trim" ) var trimSize = Vector2( 3, 1 ) fun shape( diameter : double ) : Shape2d { return if (slotDistance > 0) { val circle = Circle( diameter / 2 ) return circle.hull( circle.translateX( slotDistance ) ) .centerX() } else { Circle( diameter / 2 ) } } override fun build() = Compound(true).apply { val trim = shape( drillDiameter + trimSize.x*2 ) .smartExtrude(trimSize.y) .bottom( Chamfer( trimSize.y ) ) val tube = shape( drillDiameter - clearance*2 ) .extrude( depth ) .bottomTo( trim.top ) val hole = shape( internalDiameter - clearance*2 ) .smartExtrude( tube.top + 0.02 ) .bottom( Chamfer(-trimSize.y*0.6, trimSize.y*0.6) ) .bottomTo( -0.01 ) + trim + tube - hole }.build() }