import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* import uk.co.nickthecoder.foocad.screws.v3.* include Wheel.foocad class LumberTrolley : Model { var size = Vector3( 220, 90, 80 ) var clampSize = Vector3( 46, 8, 20 ) var wheel = Wheel().apply { hubSize = Vector2( 110, 30 ) tyreThickness = 8 tyreRounding = 7 capSize=Vector2(7, 2) axelDiameter = 10 } @Piece meth hubCap() = wheel.hubCap() @Piece meth hub() = wheel.hub() @Piece meth tyre() = wheel.tyre() @Piece meth axelClamp() : Shape3d { val radius = wheel.axelDiameter/2 val shape = Circle( radius + clampSize.y*0.9 ) + Square( clampSize.x, clampSize.y ) .roundCorner(1, 2) .roundCorner(0, 2) .center() - Circle( radius ) - Square( clampSize.x ).centerX().frontTo( radius - 1 ) - Square( radius * 2 ).centerX() var screwHoles : Shape3d = Countersink( 4, 8 ) .rotateX(90) .frontTo( - clampSize.y / 2 ) .leftTo( radius + clampSize.y ) .mirrorX().also() val gap = ( clampSize.z - screwHoles.size.z*2 ) / 3 if ( gap > 3 ) { screwHoles = screwHoles.topTo( clampSize.z - gap ) .bottomTo( gap ).also() } screwHoles = screwHoles.centerZTo( clampSize.z / 2 ) val main = shape .smartExtrude( clampSize.z ) .edges( Chamfer(1) ) return main - screwHoles } @Piece meth handle() : Shape3d { val thickness = 10 val outside = Square( 125, 50 ).center() .roundCorner(3, 10) .roundCorner(2, 10) val inside = Square( 95, 26 ).centerX() .backTo( outside.back - 10 ) .roundAllCorners(5) val ridge = Square( inside.size.x - 25*2, 4 ) .roundCorner(3,2) .roundCorner(2,2) .centerX() .frontTo( inside.front-0.01) val main = (outside - inside + ridge) .smartExtrude( thickness ) .bottom( roundedChamfer( 3 ) ) .top( Fillet( 3 ) ) val ledge = Square( 15, 20 ) .leftTo( main.left ) .roundAllCorners(3) .extrude( 3 ) .rotateX(90) .frontTo(outside.front) .bottomTo(3) .mirrorX().also() val reinforcementShape = (Square(30).backTo(0) - Circle(30)) .scaleX(0.4) val reinforcements = reinforcementShape .extrude( 2 ) .rotateY(90) .bottomTo( main.top ) .centerXTo( main.left + 8 ) .frontTo( ledge.back ) .mirrorX().also() return main + ledge + reinforcements } @Piece meth halfHandle() = handle().bottomTo( - 5 ) - Cube( 200 ).centerXY().topTo(0) override fun build() : Shape3d { val wheelAssembly = wheel.assembly() .leftTo( size.x / 2 + 3 ) val axel = Cylinder( (wheelAssembly.right - wheel.capSize.y - 1)*2, wheel.axelDiameter/2 ) .rotateY(90) .centerX() .color("GhostWhite") val base = Cube( size.x, size.y, 8 ) .centerX() .topTo( 0 ) .color( "Green" ) val sides = Cube( 20, size.y, size.z ) .leftTo( base.left ) .frontTo( base.front ) .bottomTo( base.top ) .mirrorX().also() .color( "DarkGreen") val back = Cube( size.x - 40, 20, size.z ) .centerX() .frontTo( base.front ) .bottomTo( sides.bottom ) .color( "Green" ).brighter() val stand = Cube( 60, 20, 15 ) .centerX() .backTo( base.back ) .topTo( base.bottom ) val clamps = axelClamp() .rotateY(90) .leftTo( -size.x / 2 ).mirrorX().also() val box = (base + sides + back + stand) .translateZ(-size.z/2) .frontTo( clamps.back ) return wheelAssembly.mirrorX().also() + axel + box + clamps } }