import uk.co.nickthecoder.foocad.extras.v1.* import static uk.co.nickthecoder.foocad.extras.v1.Extras.* import uk.co.nickthecoder.foocad.cup.v1.* import static uk.co.nickthecoder.foocad.cup.v1.Cup.* import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* class GroundSpikeCover : Model { @Custom( about="Diameter of the main tube" ) var diameter = 24.7 // 32 @Custom( about="Depth of the tube") var depth = 30 @Custom( about="Thickness of the walls" ) var thickness = 1.2 @Custom( about="Width and thickness of the overlap, making it easier to see, and shielding from rain." ) var overlap = Vector2(12, 5) @Custom( about="Diameter and depth of the hole which aids lifting" ) var handleSize = Vector2( 40, 8 ) @Piece @Slice( fillDensity=5 ) meth plain() : Shape3d { val capShape = Circle( diameter/2 + overlap.x ) val cap = capShape .smartExtrude( overlap.y ) .bottom( ProfileEdge.fillet(3) ) .top( ProfileEdge.step( 3, -2 ) and ProfileEdge.step( 2, 2 ) ) val outside = Circle( diameter/2 ) val tube = outside .cup( depth, thickness ) .baseThickness( 0.1 ) .insideBottom( ProfileEdge.fillet( 3 ) ) //.outsideBottom( ProfileEdge.fillet( 3 ).reverse() ) .insideTop( ProfileEdge.chamfer( -2 ) and ProfileEdge.flat(2)) .outsideTop( ProfileEdge.chamfer( 1 ) ) .bottomTo( cap.top ) return cap + tube } @Piece( about="Only suitable for larger covers" ) meth withHandle() : Shape3d { val plain = plain() val handleCircle = Circle( handleSize.x/ 2 ) val recess = Cup( handleCircle, handleSize.y, thickness*1.5 ) .cavity( true ) .bottom( Chamfer( handleSize.y/4 ) ) .insideTop( Chamfer( 1 ) ) .mirrorZ() .bottomTo(0) val handleShape = ProfileEdge.mouldingExtra( thickness, handleSize.y - thickness*1.5, ProfileEdge.chamfer(-1), ProfileEdge.chamferedStep( -1, 2 ) ).mirrorX().also() val handle = handleShape .extrude( recess.size.x - thickness ) .rotateX(90).centerY() return plain and recess insert handle } @Piece( about="Adds a lip, to help lift up the cover" ) meth withPullup() : Shape3d { val plain = plain() val handleCircle = Circle( handleSize.x/ 2 ) val recess = Cup( handleCircle, handleSize.y, thickness*1.5 ) .cavity( true ) .bottom( Chamfer( handleSize.y/4 ) ) .insideTop( Chamfer( 1 ) ) .mirrorZ() .bottomTo(0) val pullup = Segment( handleSize.x/2, -60, 60 ) .extrude( thickness*1.5 ) return plain and recess insert pullup } @Piece( print="withHandle" ) override fun build() : Shape3d { return withHandle().mirrorZ().bottomTo( 0 ) } }