Exit Full View
Up

/Printer/Dave.foocad

Dave
FooCAD Source Code
/**
    A name tag for my 4th printer, a Artillery Genius.
    There are holes for thin magnets, so that I can stick it wherever I want,
    but most of the time, I expect it to cover up the SD card and USB holes.
    (Having holes on the TOP surface is stupid... Dust and other gunk will
    fall in).
*/

import static uk.co.nickthecoder.foocad.chamferedextrude.ChamferedExtrude.*

class Frank : Model {

    @Custom
    var name = "DAVE"
    @Custom
    var height = 2.6
    @Custom
    var magnetD = 11 // Diameter of the magnets on the feet (include some slack?)
    @Custom
    var magnetT = 1.0 // Thickness of the magnets (include some slack?)


    // I'm printing this with the text facing downwards, so that we can see the
    // glass's texture on the vsible surface.
    override fun build() : Shape3d {
        val text = Text( name, BOLD, 10 ).offset( 0.3 ).center()
        val background = text.boundingSquare().scaleX(1.2).offset(2).roundAllCorners(4)
            .extrude(height)
        val base = background - text.extrude(magnetT).topTo(height)
        val magHoles = Cylinder( magnetT, magnetD/2 ).leftTo(base.left+3)
            .mirrorX().also()

        println( "Size ${base.size}" )
        return base - magHoles
    }
}