Exit Full View
Up

/Tools/ClampEndStop.foocad

ClampEndStop
FooCAD Source Code
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*
/**
    I've lost the end stop to one of my clamps.
    I don't suppose this replacement will be anywhere near as strong as the clamp can squeeze,
    so I'll have to be careful with it. Better than nothing.
*/

class ClampEndStop : Model {

    var rodSize = Vector2(21,6.5)
    var size = Vector2( 60, 30 )
    var height = 80
    var thickness = 20

    val holeD = 6.0
    
    override fun build() : Shape3d {
        val hole2Y = height/2 + size.y/2

        val profile = (Square( size ) hull Square( 10, height )) +
            Square( 44, 20 ).roundCorner(2,5)
                .centerYTo(hole2Y)

        val main = profile.chamferedExtrude( 20, 2 )

        val slot = Cube( size.x + 2, rodSize.x, rodSize.y )
            .leftTo(-1)
            .centerYTo( size.y / 2 )
            .centerZTo( thickness/2 )

        // Note, the hole will need drilling out, otherwise the bridging of the slot
        // wouldn't work.
        val hole = Cylinder( thickness/2, holeD/2 )
            .centerXTo( size.x/2 )
            .centerYTo( size.y/2 )
            .bottomTo(-1)
            .bottomTo(slot.top+1.6).also()

        val hole2 = Cylinder( 200, 4 ).center()
            .rotateY(90)
            .centerYTo( hole2Y )
            .centerZTo(thickness/2)

        return main - slot - hole - hole2
    }
}