import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* import static uk.co.nickthecoder.foocad.along.v2.Along.* class HedgehogBox : Model { val tileSize = Vector3( 450, 450, 25 ) var size = Vector2( 420, 400 ) override fun build() : Shape3d { val decking = Lumber( "main", 120, 25 ) val halfDecking = Lumber( "main", 60, 25 ) val batton = Lumber( "batton", 32, 32 ) val frontBack1 = decking.cut( size.x ) .label("frontBack") .alongX().rotateX(90) .translateY(size.y - decking.thickness).also() val frontBack2 = halfDecking.cut( size.x ) .label("frontBack") .alongX().rotateX(90) .translateY(size.y - decking.thickness).also() .bottomTo( frontBack1.top + 1 ) val frontBack = frontBack1 + frontBack2 val leftRight = decking.cut( size.y - decking.thickness * 2 ) .color("Green") .alongY() val leftRight2 = halfDecking.cut( size.y - decking.thickness * 2 ) .color("Green") .alongY() .bottomTo( leftRight.top + 1 ) val left1 = leftRight .label( "left1" ) val left2 = halfDecking.cut( size.y - decking.thickness * 2 ) .label( "left2" ) .color("Green") .alongY() .bottomTo( left1.top + 1 ) val left = left1 + left2 val opening = decking.cut( size.y - decking.thickness * 2 - decking.width ) .color("Green") .alongY() val right = (opening + leftRight2) .rightTo( size.x ) val mid = right.mirrorY() .frontTo(0) .rightTo( right.left - decking.width ) val roof = Cube( tileSize ) .centerTo( size.x / 2, size.y / 2 - decking.thickness, 0 ) .bottomTo( decking.width * 1.5 + 1 ) .previewOnly() val entrance = batton.cut( decking.width + decking.thickness * 2 ) .alongY() .color( "LightGreen") .leftTo( right.right ) .backTo( frontBack.back ) .bottomTo( decking.width ) val floor = decking.cut( size.y ) .label( "floor" ) .rotateX(-90) .frontTo( - decking.thickness ) .tileX(4, 4) .color( "White" ) val tilt = batton.cut( size.y ) .label("tilt") .alongY() .frontTo( -decking.thickness ) .topTo(floor.bottom) .color( "LightGreen") return frontBack + left + right + mid + roof + entrance + tilt + floor } }