import uk.co.nickthecoder.foocad.threaded.v2.* import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* import uk.co.nickthecoder.foocad.cup.v1.* import static uk.co.nickthecoder.foocad.cup.v1.Cup.* class WateringCan : Model { @Custom var size = Vector3( 250, 140, 150 ) @Custom var round = 50 @Custom var wallThickness = 1.8 @Custom var baseThickness = 1.8 @Custom var spoutThread = Thread( 30 ) @Piece meth body() : Shape3d { val shape = Square( size.x, size.y ).center() .roundAllCorners(round) val outside = shape.smartExtrude( size.z ) .bottom( ProfileEdge.roundedChamfer( round ) ) .top( ProfileEdge.roundedChamfer( round ) ) val inside = shape.offset( -wallThickness ) .smartExtrude( size.z - baseThickness + 0.01 ) .bottom( ProfileEdge.roundedChamfer( round ) ) .top( ProfileEdge.roundedChamfer( round ) ) .bottomTo( baseThickness ) val main = outside - inside val rim = shape.offset(-round/2 + 4) .smartExtrude( 7 ) .top( Fillet(4) ) .topTo( outside.top ) val spoutStub = Circle( spoutThread.diameter / 2 ) .smartExtrude( 50 ) .top( Chamfer(1) ) .offsetBottom(5) val thread = spoutThread.threadedRod( 16 ) .chamferBottom(false) .bottomTo( spoutStub.top - 1 ) val spoutHole = Circle( spoutThread.coreRadius() - 1.8 ) .smartExtrude( thread.top + 0.02 ) .bottomTo( -0.01) val spout = (spoutStub.and( thread ).remove( spoutHole ) ) .rotateY(45) .translateX( size.x / 2 -20).translateZ( size.z/2-20 ) return main and rim and spout remove inside } override fun build() : Shape3d { return body() } }