FooCAD Source Codeimport static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*
/**
Use a "follower" bit on a router to make rounded corners.
For small radii, solid jobbies such as these are good :
https://www.printables.com/model/191576-router-radius-jig-r51015202530
However, for a one-off template for a larger radius, I've created my own model.
*/
class RouterRadius : Model {
@Custom
var radius = 80
var extra = 20
var width = 10
var thickness = 7
var chamfer = 0.8
var engraveDepth = 1.0
override fun build() : Shape3d {
val r0 = 1
val r1 = 5
val r2 = 20
val profile = PolygonBuilder().apply {
moveTo( 0, -radius )
Quality.push()
Quality.quality( 6 ) // The circular arc must be high res, we don't want to see the mesh!
circularArcBy( radius, radius, radius, false, false )
Quality.pop() // Everything else can use the normal quality setting
radius(r1)
lineBy(extra,0)
radius(r0)
lineBy( 0, width )
lineBy( extra, 0 )
lineBy( 0,-width )
radius(r2)
lineBy( 0, -width )
lineBy( -radius -width - extra, -radius - width - extra )
lineBy( -width, 0 )
radius(r0)
lineBy( -width, 0 )
lineBy( 0, extra )
radius(r1)
lineBy( width, 0 )
radius(0)
lineBy(0, extra)
}.build()
val locators = Square( extra, width ).leftTo(radius+extra) +
Square( width, extra ).backTo(-radius-extra).rightTo(0)
val markers = Square( 1, width/2 ).leftTo(radius).backTo(-width/4) +
Square( width/2, 1 ).leftTo(width/4).backTo(-radius)
val textOffset = (radius+extra*2+width/2)/2-1
val text = Text("R$radius", BOLD).center()
val positionedText = text.mirrorX()
.rotate(45).translate(textOffset, -textOffset)
val blob = text.margin(4, 2).boundingSquare().roundAllCorners(2)
.rotate(45).translate(textOffset, -textOffset)
val line = PolygonBuilder().apply {
moveTo( blob.middle )
lineTo( radius*0.3, -radius*0.3 )
}.buildPath().thickness(width)
val hollow = profile - (profile-locators).offset(-width) + blob + line
return hollow.chamferedExtrude( thickness, chamfer ) +
locators.roundAllCorners(r0).chamferedExtrude( thickness+chamfer, 0, chamfer ).bottomTo(thickness-chamfer) -
(markers + positionedText).extrude(engraveDepth+1).bottomTo(-1)
}
}