Exit Full View
Up

/Boxes/BoxNet.foocad

BoxNet

Creates a folding cube. It's just a test for the strength of thin plastic as hinges.

FooCAD Source Code
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*

class BoxNet : Model {
    
    @Custom
    var size = 30

    @Custom
    var thickness = 2.0

    @Custom
    var thin = 0.4

    override fun build() : Shape3d {
        val face =
            Square( size- thin*2 ).center()
                .chamferedExtrude( thickness, 0, thickness - thin ) +
            Square( size ).center()
                .extrude( thin ) -
            Cube( size/2 ).center()
        val net = face.repeatX(3, size) + face.repeatY(4, size).translate(size, -size, 0)
        return net
    }
}