Exit Full View
ZipUp

/Bedroom/Organiser2.foocad

Organiser2

An organiser for pills and other items that I keep in my bedside drawer.

This is custom to my needs

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

class Organiser2 : AbstractModel() {
    
    @Custom
    var thickness = 1

    @Custom
    var baseThickness = 1

    fun roundedRect( x : double, y : double ) = Square( x, y ).roundAllCorners( 2 )

    fun make( shape : Shape2d, height : double ) = shape.extrude( height ) -
        shape.offset(-thickness).extrude( height ).translateZ( thickness )

    override fun build() : Shape3d {
    
        val rects = arrangeY( - thickness,
            make( roundedRect( 80, 20 ), 50 ),
            make( roundedRect( 74, 15 ), 45 ),
            make( roundedRect( 66, 15 ), 40 ),
            make( roundedRect( 60, 15 ), 35 )
        )
        val circles = arrangeY( - thickness,
            make( Circle( 31/2 ).leftTo(0), 20 ),
            make( Square( 28, 43 ).leftTo(0).roundAllCorners( 14 ), 20 )
        ).mirrorX()

        return arrangeX( -thickness, circles, rects )
    }
}