/Hardware/ScrewBlock.foocad

These blocks were common on early flat-pack furniture. It helps to screw two pieces of wood/chipboard together.
import uk.co.nickthecoder.foocad.screws.v3.*
import uk.co.nickthecoder.foocad.smartextrusion.v1.*
import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.*
class ScrewBlock : Model {
@Custom
var size = Vector3( 32, 10, 14 )
@Custom
var screwHole = Countersink()
@Custom
var round = 5
@Custom
var holeMargin = 1.0
@Piece
meth block() : Shape3d {
val block = Square( size.x, size.y ).center()
.roundCorners(listOf<int>(0,1),round)
.smartExtrude( size.z )
.edges( Chamfer(0.5) )
val screwsZ = screwHole.topTo( block.top )
.centerXTo( size.x * 0.3 )
.frontTo( block.front + holeMargin )
.mirrorX().also()
val screwY = screwHole.rotateX(90)
.topTo( block.top - holeMargin )
.frontTo( block.front )
return block - screwsZ - screwY
}
override meth build() = block()
}
