/House/PostTurn.foocad

A simple turning mechanism using print-in-place.
Beware elephant's foot will cause the meachanism to get locked. Adjust : Slicer Settings -> Print -> First Layer Size Compensation.
import uk.co.nickthecoder.foocad.extras.v1.*
import static uk.co.nickthecoder.foocad.extras.v1.Extras.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*
import uk.co.nickthecoder.foocad.screws.v3.*
import uk.co.nickthecoder.foocad.smartextrusion.v1.*
import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.*
abstract class GeneralTurn : Model {
@Custom
var thickness = 3
@Custom
val raised = 32
@Custom
var stemDiameter = 12
@Custom
var flatten = 1
@Custom
var chamfer = 2
@Custom
val clearance = 0.5
meth width() = stemDiameter - flatten/2
@Piece
meth print() : Shape3d = build().rotateX(-90).translateZ(width()/2)
abstract meth head() : Shape3d
meth attachments() : Shape3d {
val lug = Square( 26, 12 ).roundAllCorners(5).centerY()
.smartExtrude(4).top(Chamfer(1)) -
Countersink().topTo(4).translateX( 26 - 6 )
return lug.mirrorX().also()
}
@Piece( print="print" )
override meth build() : Shape3d {
val width = width()
val stemShape = Circle(stemDiameter/2 + chamfer)
val stem = ExtrusionBuilder().apply {
crossSection(stemShape)
forward(1)
crossSection()
forward( chamfer )
crossSection( -chamfer )
forward(raised - chamfer- thickness*2- clearance)
crossSection()
}.build().translateZ(thickness + clearance)
val holeShape = Circle(stemDiameter/2 + chamfer + clearance).safeOverhang().mirrorY()
val hole = ExtrusionBuilder().apply {
crossSection(holeShape)
forward(1+clearance*2)
crossSection()
forward( chamfer )
crossSection( -chamfer )
forward( raised )
crossSection()
}.build().translateZ(thickness)
val fixture = Circle( stemDiameter/2 + clearance + thickness + chamfer )
.smartExtrude( raised - 1 - thickness )
.top(
ProfileEdge.cove( chamfer )
and ProfileEdge.step( 0.001, raised - thickness*2 - chamfer*2 - 3 )
and ProfileEdge.chamfer(1)
)
.bottom( (ProfileEdge.fillet(3).reverse()) and (ProfileEdge.cove(2).reverse()) )
val head = head()
val slice = Cube( 100 ).centerX().frontTo( width/2 )
val all = stem + (fixture + attachments() - hole) + head
return all - slice
}
}
class PostTurn() : GeneralTurn() {
@Custom
var poleDiameter = 50
override meth head() : Shape3d {
return Ring( poleDiameter/2 + thickness, poleDiameter/2 )
.smartExtrude( width() )
.edges( Chamfer(0.8) )
.rotateX(90).centerY()
.translateZ( raised + poleDiameter/2 )
}
@Piece( print="print" )
override meth build() : Shape3d {
val pole = Cylinder( 100, poleDiameter/2 )
.rotateX(90).centerZTo( raised + poleDiameter/2 ).translateY(40)
.previewOnly()
return super.build() + pole
}
}
