FooCAD Source Code/**
I lost a lens cap for my binoculars many years ago.
With a 3d printer and TPU filament, I can make a replacement that fits perfectly.
I printed 2, because when I tested the fit, the *original* lens cap fell off.
No wonder I lost the original - they are too big!
NOTE
My eyepieces are very nearly 40mm diameter, so a 40.3 mm internal diameter,
and a 0.6 inset means that the final internal diameter is SMALLER than the binoculars.
So it will need to stretch to fit on, and therefore be a snug fit, which will not fall off.
However, my final parts are SMALLER than intended, but still fit fine.
If your printer/slicer is setup "correctly" to account for shrinkage of the final piece,
maybe you will need to reduce the size to make it as snug as my prints.
*/
class LensCap : Model {
@Custom(about="Internal diameter and depth")
var size = Vector2( 40.3, 8 )
@Custom(about="Thickness of the edges (not the base)")
var thickness = 1.2
@Custom(about="Thickness of the base - the part that touches the build plate")
var baseThickness = 2.4
@Custom( about="Thickner in the middle buy a little bit to help the cap stay on" )
var inset = 0.6
@Custom
var chamfer= 0.8
override fun build() : Shape3d {
return ExtrusionBuilder().apply {
crossSection( Circle( size.x / 2 + thickness -chamfer ) )
forward( chamfer )
crossSection( chamfer )
forward( size.y + baseThickness - chamfer )
crossSection()
crossSection( -thickness )
forward( - size.y /2 )
crossSection(-inset)
forward( ( - size.y + chamfer ) /2 )
crossSection(+inset)
forward( -chamfer )
crossSection( -chamfer )
}.build()
}
}