import static uk.co.nickthecoder.foocad.along.v3.Along.* import uk.co.nickthecoder.foocad.woodworking.v1.* import static uk.co.nickthecoder.foocad.woodworking.v1.Woodworking.* import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.* import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.* class HedgehogBox : AbstractModel() { val tileSize = Vector3( 450, 450, 25 ) var size = Vector2( 420, 400 ) var openingSize = 120 @Piece( printable = false ) override fun build() : Shape3d { val decking = Wood( "main", 120, 25 ) val halfDecking = Wood( "main", 60, 25 ) val batton = Wood( "batton", 32, 32 ) val sides1 = decking.cut( size.x ) .label("side1") .edgeDownAlongX() .translateY(- decking.thickness) .translateY(size.y - decking.thickness).also() val sides2 = halfDecking.cut( size.x ) .label("side2") .edgeDownAlongX() .translateY(- decking.thickness) .translateY(size.y - decking.thickness).also() .bottomTo( sides1.top + 1 ) val sides = (sides1 + sides2) val across1 = decking.cut( size.y - decking.thickness * 2 ) .label( "across1" ) .color("Green") .edgeDownAlongY() val across2 = halfDecking.cut( size.y - decking.thickness * 2 ) .label( "across2" ) .color("Green") .edgeDownAlongY() .bottomTo( across1.top + 1 ) val withOpening = decking.cut( size.y - decking.thickness * 2 - openingSize ) .label( "withOpening" ) .color("Green") .edgeDownAlongY() val back = across1 + across2 val front = (across2 + withOpening) .rightTo( size.x ) val mid = (across2 + withOpening) .mirrorY().frontTo(0) .rightTo( front.left - openingSize ) val roof = Cube( tileSize ) .centerTo( size.x / 2, size.y / 2 - decking.thickness, 0 ) .bottomTo( decking.width * 1.5 + 1 ) .previewOnly() val overEntrance = batton.cut( openingSize + decking.thickness * 2 ) .edgeDownAlongY() .color( "LightGreen") .leftTo( sides1.right ) .backTo( sides.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") .sideDownAlongY() .scaleZ(0.3) .frontTo( -decking.thickness ) .topTo(floor.bottom) .color( "LightGreen") val all = sides + back + mid + front + overEntrance + tilt + floor + roof return all.rotateY(1) } }