Exit Full View
Up

/Tools/RightAngle.foocad

RightAngle
FooCAD Source Code
import uk.co.nickthecoder.foocad.smartextrusion.v1.*
import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.*

class RightAngle : Model {

    @Custom
    var size = Vector3( 100, 75, 15 )

    @Custom
    var width = 20.0
    
    @Custom
    var triangulate = 10.0

    @Custom
    var round = 1.0

    @Custom
    var chamfer = 1.0

    override fun build() : Shape3d {
        val shape = (
            Square( size.x, size.y ) -
            Square(size.x, size.y).translate( width, width )
        ).toPolygon()
            .roundCorners(listOf<int>(2,3,4,5),round)
            .roundCorner(1,triangulate,1)
            .roundCorners(listOf<int>(0),round)

        return shape.smartExtrude( size.z )
            .edges( Chamfer(chamfer) )
    }

}