FooCAD Source Codeimport static uk.co.nickthecoder.foocad.screws.v1.Screws.*
/**
Screwed these to my front wall.
There is a similar script Words/Outline.foocad without the screw holes.
If I were to rewrite this, use Outline.foocad to create the numbers.
This implementation existed before ExtrusionBuilder could handle hollow shapes,
so it creates the outlines "manually".
*/
class HouseNumbers : Model {
var thickness = 3
var width = 3
var outsideChamfer = 1
var insideChamfer = 0.5
fun screw( y : double ) : Shape3d {
val hole = keyholeHanger( 4, 8 ).mirrorZ()
val profile = Circle( 9 ).scaleX(0.7)
val solid = ExtrusionBuilder().apply {
crossSection( profile )
forward( 4 - outsideChamfer )
crossSection()
forward(outsideChamfer)
crossSection( profile.offset(-outsideChamfer) )
}.build()
return solid.remove(hole.translateY(4.5)).translateY( y )
}
fun number( n : String ) : Shape3d {
val text = Text(n, BOLD, 120)
val smaller = text.offset( -width )
val outside = ExtrusionBuilder().apply {
crossSection(text)
forward(thickness - outsideChamfer)
crossSection()
forward( outsideChamfer )
crossSection( text.offset(-outsideChamfer) )
}.build()
val inside = ExtrusionBuilder().apply {
forward(-1)
crossSection(smaller)
forward(1 + thickness - insideChamfer )
crossSection()
forward( insideChamfer )
crossSection( smaller.offset( insideChamfer ) )
forward( 1 )
crossSection()
}.build()
return (outside-inside).centerXY()
// return outline.extrude( thickness ).centerXY()
}
@Piece
fun two() = number( "2" ).and(screw( 61 )).and( screw( -61 ) )
@Piece
fun three() = number( "3").and(screw( 61 )).and( screw( -61 ) )
override fun build() : Shape3d {
val n3 = number( "3" ).and(screw( 61 )).and( screw( -61 ) )
val n2 = number( "2" ).and(screw( 61 )).and( screw( -61 ) )
return n3.translateX(-100) + n2 + n2.translateX(100)
}
}