Exit Full View
Up

/Printer/SlackCalibration.foocad

SlackCalibration

Creates a piece with movable parts, with various clearances. You can then use thi info when making your own model. My cheap no-brand Chinesse printer with cheap filament can only handle slack of 0.4 when printed using 0.2 layer height.

To insect a failure, cut through the opposite half from where you want to inspect, and then snap the piece in half. Hopefully this will reveal more than cutting would.

Interestingly Slic3r changes behavior between slack of 0.1 and 0.2. The 0.2 i sliced as expected, but the 0.1 i sliced so that the pieces are fused! This is with a 0.2 layer height - I should check if a smaller layer height changes the point at which it decides to fused the pieces.

FooCAD Source Code
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*

class SlackCalibration : Model {
    
    var size = 33
    var sides = 30
    val height = 6
    val middle = 2 // The height of the constant width section in the middle

    val baseChamfer = 0.6 // Give extra space for elephant's foot on the first layers
    val topChamfer = 0.6 // This shouldn't be needed, so is only decorative

    fun turn( slack : double, angle : double ) : Shape3d {

        val circle = Circle(8-slack).sides(sides) 
        val knob = Cube( 20, 5, height ).centerY()

        val half = (height - middle)/2-slack/2/Math.sqrt(2)
        val myMiddle = height - half*2
    
        val main = ExtrusionBuilder().apply {

            crossSection( circle.offset(half-baseChamfer*2) )
            forward( baseChamfer )
            crossSection( circle.offset(half-baseChamfer) )

            forward(half-baseChamfer)
            crossSection( circle )

            forward( myMiddle )
            crossSection()

            forward(half-topChamfer)
            crossSection( circle.offset(half-topChamfer) )

            forward(topChamfer)
            crossSection( circle.offset(half-topChamfer*2) )

        }.build()

        val str = "$slack".substring(1)
        val result = main + knob - Text( str, BOLD, 8 ).center().extrude(10).translateZ(height-0.4)
        return result.translateX(size-10).rotateZ(angle)
    }

    override fun build() : Shape3d {
    
        val hole = (Circle(8).sides(sides) + Square( 15, 12 ).centerY())
            .translateX(size - 10)
            
        var bodyP : Shape2d = Circle(size).sides(sides) - hole.repeatAround( 6 )

        val chamfer = (height-middle)/2
        val body = bodyP.chamferedExtrude(height, chamfer) -
            Circle( size*0.3 ).internalChamferedExtrude( height, chamfer )

        val result = body +
            turn(0.2, 0) +
            turn(0.25, 60) +
            turn(0.3, 120) + 
            turn(0.4, 180) +
            turn(0.5, 240) +
            turn(0.6, 300)


        val inspect = Cube( 1000, 0.4, 1000 ).center().repeatAroundZ(6) +
            Cube( 1000, 1000, 0.1 ).centerXY().translateZ( height/2 )

        // Remove one slash before Cube to inspect the voids by slicing through them,
        // and use render mode in OpenSCAD, because previewMode doesn't allow zooming in.
        return result // inspect

    }
}