import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.* import uk.co.nickthecoder.foocad.screws.v3.* import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* class UnderShelf : AbstractModel() { var length = 160 var backThickness = 4 val holeCount = 3 override fun build() : Shape3d { val doc = SVGParser().parseFile( "underShelf.svg" ) val profile = doc.shapes["profile"] val extrusion = profile.chamferedExtrude( length, 0, 1 ) val back = doc.shapes["back"].extrude( backThickness ) val solid = (extrusion + back).centerX().backTo(0) val hole = Countersink( 4, 8 ).recess( 20 ).depth( 40 ).rotateX(90) .translateX(-10).translateY(-20-4) val holes = hole.spreadZ( holeCount, length * 0.8 ) .translateZ(length * 0.1 ) val single = solid - holes return single.translateY(-1).mirrorY().also() } }