Exit Full View
Up

/Tools/AdhesiveSpreader.foocad

AdhesiveSpreader
FooCAD Source Code
import static uk.co.nickthecoder.foocad.extras.v1.Extras.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*

class AdhesiveSpreader : Model {

    @Custom
    var size = Vector3( 70, 50, 2 )

    @Custom
    var toothSize = Vector2( 5, 3 )

    @Custom
    var square = false

    override fun build() : Shape3d {
        val body = Square( size.x, size.y ).center()
            .roundCorner(3,5)
            .roundCorner(2,5)
            .extrude( size.z )

        val teeth = if (square) {
            Square( toothSize ).tileXWithin( size.x, toothSize.x )
        } else {
            Triangle( toothSize.x, toothSize.y, toothSize.x /2 )
                .roundCorner(2,0.5,1)
                .mirrorY()
                .tileXWithin( size.x, 1 )
        }.centerX().backTo( body.front ).extrude( size.z )

        return body + teeth
    }

}