Exit Full View
Up

/Printer/GeniusSpoolRoller.foocad

GeniusSpoolRoller
FooCAD Source Code
import static uk.co.nickthecoder.foocad.ears.v1.Ears.*
/**
    For Genius and Artillery X1/2 printers.
    Adds 2 rollers, so that any filament spools can be placed on the printer
    without having to adjust the width to match the spool's width.

    You need 2 rollers per printer.

Print Notes
    I added ears with ribs, radius 14, as this is very tall, with a small footprint.
*/
class GeniusSpoolRoller : Model {

    @Custom(about="Length of the middle section of the roller" )
    var maxWidth = 85 // The maximum width of your spools.   
    
    @Custom( about="Side of the chamfer at the ends of the roller" )
    var chamfer = 4
    
    @Custom( about="Diameter of the roller" )
    var diameter = 20

    @Custom (about = "Thickness of the wall" )
    var thickness = 1.2

    @Custom( about="Position of the lip, which stops the spool moving left/right too much")
    var lipAt = 10

    // My first print used 4mm, which is a bit too big!??
    @Custom( about="The height of the lip" )
    var lipChamfer = 2

    @Custom( about="Diamter and depth of the holes to house the bearings" )
    var bearing = Vector2(14.4, 18)


    // A generous brim, is needed due to the height and small footprint.
    // All perimeters - no infill
    @Slice( brimWidth=20, perimeters=50 )
    override fun build() : Shape3d {
        val circle = Circle( chamfer + diameter/2 )
        val main = ExtrusionBuilder().apply {
            crossSection( circle )
            forward(2)
            crossSection()
            forward( chamfer )
            crossSection( -chamfer )
            forward( lipAt )
            crossSection()
            forward( lipChamfer )
            crossSection( lipChamfer )
            forward(1)
            crossSection()
            forward( lipChamfer )
            crossSection( -lipChamfer )
            forward( maxWidth - lipChamfer * 2 - 1 - lipAt + chamfer + 2 )
            crossSection()
        }.build()


        val insideRadius = diameter/2 - thickness
        val diff = insideRadius - bearing.x/2
        val hole = ExtrusionBuilder().apply {
            crossSection( Circle( bearing.x/2 ) )
            forward( bearing.y )
            crossSection()
            forward( diff )
            crossSection( Circle(insideRadius ) )
            forward( main.top - diff * 2 - bearing.y * 2 )
            crossSection()
            forward(diff)
            crossSection( Circle( bearing.x/2 ) )
            forward(bearing.y )
            crossSection()
            
        }.build()

        // Even with Ears, I've still had failures when the top had a chamfer similar to be bottom
        // return main + ears( main, 19 ).ribs( 0.8, 2 ).ribsMargin(0.5) - hole
        return main - hole
    }

    /**
        The part got knocked over by the hot-end when printing the top chamfer,
        So this piece is to be glued to the main part. An annoying bodge, but it works!
    */
    @Piece
    fun extraChamfer() : Shape3d {
                val circle = Circle( chamfer + diameter/2 )
        val main = ExtrusionBuilder().apply {
            crossSection( circle )
            forward(2)
            crossSection()
            forward(chamfer)
            crossSection(-chamfer)
        }.build()


        val hole = Cylinder( 100, diameter/2 + 0.1 ).center()

        return main - hole

    }

}