/Tools/Clamp.foocad

A mini clamp, useful for adding pressure when glueing small items.
The pieces are easy to print. No supports needed.
However, I recomment a brim when printing the long thin bolt, to ensure it does get knocked over.
It produces a reasonable pressure, but I'm sure it's very easy to strip the threads if you tighten a lot.
If the threads do strip, you could melt in a threaded insert, and use a regular metal bolt ;-))
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*
import uk.co.nickthecoder.foocad.threaded.v2.*
import static uk.co.nickthecoder.foocad.threaded.v2.Thread.*
class Clamp : AbstractModel() {
@Custom( about="The internal size of the clamp" )
var size = Vector2(20,25)
@Custom( about="Width and thickness" )
var thickness = 10
@Custom
var threadDiameter = 6.0
@Custom
var footSize = Vector2(9,4)
@Custom
var clearance = 0.35
meth thread() = Thread(threadDiameter)
.headSize(Vector2(threadDiameter*2,threadDiameter*8/6))
.headChamfer(threadDiameter/6)
.rodChamfer(threadDiameter/60)
.clearance(clearance)
@Piece
fun clamp() : Shape3d {
val thread = thread()
val profile = Square( size.x + thickness, size.y + thickness * 2 ).centerY() -
Square( size ).centerY()
val c = profile.toPolygon().roundAllCorners(2).chamferedExtrude( thickness, 1 )
val hole = thread.threadedHole( thickness*2 + 2 )
.center()
.rotateX(90)
.translate( thickness/2, 0, thickness/2 )
.frontTo( profile.front - 1 )
return c - hole
}
@Piece
fun bolt() : Shape3d {
return thread().bolt( size.y + thickness + 2 )
}
@Piece
fun boltFlat() : Shape3d {
val thread = thread()
val bolt = thread.bolt( size.y )
.rotateX(90)
.translateZ(thread.coreRadius() * 0.8 )
val slice = Cube( size.y*2 ).centerX().topTo(0).backTo(0)
return bolt - slice
}
@Piece
fun foot() : Shape3d {
val thread = thread()
val foot = Circle( footSize.x/2 )
.chamferedExtrude( footSize.y, 0.4, 1 )
val hole = thread.threadedHole( foot.top ).clipped().bottomTo( 1 )
return foot - hole
}
@Piece
fun bigBase() : Shape3d {
val base = Square( size.x+thickness-2 ).center().roundAllCorners(1)
.chamferedExtrude( thickness*0.7, 0.4, 1 )
val slot = Cube(100, thickness+0.3, 100).centerY()
.leftTo(base.left + thickness)
.bottomTo(2)
return base - slot
}
meth preview() : Shape3d {
val clamp = clamp().mirrorY()
val bolt = bolt().rotateX(90).translate( thickness/2, -clamp.front + thickness, thickness/2 )
return clamp + bolt.previewOnly()
}
override fun build() : Shape3d {
return foot().translateX(-thickness*1.5) + bolt() + clamp().translateX(-thickness/2)
}
}
