import uk.co.nickthecoder.foocad.extras.v1.* import static uk.co.nickthecoder.foocad.extras.v1.Extras.* import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* class ShelfSupport : Model { @Custom( about="Length and diameter of the stem which fits into the drilled hole" ) var stemSize = Vector2( 5, 10 ) @Custom( about="The size of flat surface that the shelf rests upon" ) var flatSize = Vector3( 12, 10, 3 ) @Custom( about="Adds extra support to the part" ) var finSize = Vector2( 3, 6 ) @Custom( about="A thin slice is taken off, which allows the curve to be printed without overhang" ) var flattern = 0.3 @Piece override fun build() : Shape3d { val chamferSize = 0.6 val flat = Square( flatSize.x, flatSize.y ).centerX().roundAllCorners(1) .smartExtrude( flatSize.z ) .edges( Chamfer(chamferSize) ) val post = Circle( stemSize.x/2 ) .smartExtrude( stemSize.y + flatSize.y - chamferSize ) .top( Chamfer( 0.6 ) ) .bottom( Chamfer( stemSize.x/2-0.1, flatSize.y - chamferSize*2 ) ) .rotateX(90) .bottomTo( - flattern ) .backTo( flat.back - chamferSize ) val slice = Cube( 50 ).centerXY() val fin = (Triangle( finSize.y + chamferSize + 1, flatSize.y - chamferSize*2 ) - Square(50).center().leftTo( finSize.y + chamferSize ) ).translateY( chamferSize ) .smartExtrude( finSize.x ) .rotateY(-90).centerX().bottomTo( flat.top - chamferSize ) val back = Square( flatSize.x, finSize.x ).centerX() .roundAllCorners( 1 ) .smartExtrude( finSize.y + chamferSize ) .top( Chamfer(chamferSize) ) .bottomTo( flat.top - chamferSize ) return flat + post.intersection( slice ) + fin + back } }