Exit Full View
Up

/Tools/Toothpick.foocad

Toothpick
FooCAD Source Code
class Toothpick : Model {
    
    var length = 40.0
    var width = 3.0
    var thickness = 1.2

    override fun build() : Shape3d {
        val shape = PolygonBuilder().apply {
            moveTo(0,0)
            lineTo(length*0.8,0)
            lineTo(length,width*0.5)
            lineTo(length*0.8,width)
            lineTo(0,width)
        }.build()

        val angle = Cube( 100 ).centerXY()
            .rotateY(3)
            .translate(length,0, width* 0.2)

        val hook = Cube( thickness, width, thickness*2 ).rotateY(-20)
        return shape.extrude( thickness ) + hook - angle
    }
}