Exit Full View
Up

/Printer/Organiser.foocad

Organiser
FooCAD Source Code
/**
    I want to keep a few things together, such as :
        glue stick, super glue, small bottle of isopropanol, torch...
    Each has its own shape
*/
class Organiser : Model {
    
    var thickness = 1

    var baseThickness = 1

    override fun build() : Shape3d {
    
        val superGlueP = Circle( 37/2 ).scaleY( 25/37 ).translate( -34 - thickness, 0.5+thickness )
        val glueStickP = Circle( 30/2 )
        val torchP = Square( 37, 26 ).roundAllCorners(1).center().translate( 34 + thickness, -2-thickness )
        val isoP = Circle( 33/2 ).translate( -16.5-thickness/2, 27.5+thickness/2 ) 
        val bottle2P = Circle( 33/2 ).translate( 16.5+thickness/2, 27.5+thickness/2 )

        val shapes = listOf<Shape2d>(superGlueP, glueStickP, torchP, isoP, bottle2P )
        var heights = listOf<int>(25, 30, 25, 18, 18) 

        val tubeList = listOf<Shape3d>()

        for ( n, shape in shapes) {
            val height = heights[n] + baseThickness
            val tube = shape.offset(thickness).extrude(height) -
                shape.extrude( height ).translateZ( baseThickness )
            tubeList.add( tube )
        }
        val tubes = Union3d( tubeList )

        return tubes
    }
}