Exit Full View
ZipUp

/Printer/FirstLayerTest.foocad

FirstLayerTest

Simple patterns to test the z-offset / first layer.

FooCAD Source Code
class FirstLayerTest : AbstractModel() {

    @Custom
    var layerHeight = 0.2

    @Custom
    var size = 220

    @Custom
    var patchSize = 20

    @Custom
    var lineWidth = 5

    // Useful if you have a BL-touch (or similar), which needs a one-off calibration
    // i.e. a small patch is sufficient to check the calibration, and in theory
    // the small patch is representative of the entire bed.
    @Piece( about="A single small circle" )
    fun circle() : Shape3d {
        return Circle( patchSize/2 ).extrude( layerHeight )
    }

    // Useful for beds with 4 manual screw adjustments.
    @Piece( about="5 patches in the patten of a dice's 5" )
    fun fivePlaces() : Shape3d {
        val patch = circle()
        return patch +
            patch.leftTo( -size/2 ).frontTo( -size/2 )
            .mirrorX().also()
            .mirrorY().also()
    }

    @Piece
    fun full() : Shape3d {
        return Square( size ).extrude( layerHeight )
    }

    // An alternative to `fivePlaces`
    @Piece( about="A sparse pattern which fills a large area (given by `size`" )
    override fun build() : Shape3d {
        
        val squares = Square( patchSize )
            .leftTo( -size /2 )
            .mirrorX().also()
            .frontTo( - size / 2 )
            .mirrorY().also() +
            Square( patchSize ).center()

        val lines = (
            Square( size, lineWidth ).center() +
            Square( size, lineWidth ).centerX().frontTo( squares.front )
            .mirrorY().also()
            ).rotate(90).also()


        return (squares + lines).extrude( layerHeight )
    }

}