import uk.co.nickthecoder.foocad.smartextrusion.v1.* import static uk.co.nickthecoder.foocad.smartextrusion.v1.SmartExtrusion.* import uk.co.nickthecoder.foocad.screws.v3.* class LongFoot : Model { @Custom( about="Size of the post" ) var size = Vector3( 19, 69, 10 ) @Custom var wallThickness = 1.8 @Custom( about="Thick enough to accept a screw-head" ) var baseThickness = 4.0 @Custom var round = 3.0 @Custom( about="A small lump in the middle for a slot in the post. Prevents the post moving backwards" ) var lumpHeight = 1.0 @Piece @Slice( perimeters=4, bottomSolidLayers=5, topSolidLayers=5, fillPattern="rectilinear", fillDensity=20 ) meth foot() : Shape3d { val outside = Square( size.x + wallThickness*2, size.y + wallThickness ) .centerX() .roundAllCorners( round + wallThickness, 8 ) val inside = Square( size.x, size.y ) .centerX() .roundCorners( listOf(0,1), round, 8 ) .backTo( outside.back + 0.01 ) val base = outside .smartExtrude( baseThickness ) //.bottom( Chamfer( Math.min(0.8,baseThickness/2) ) ) val main = (outside - inside) .smartExtrude( size.z ) .bottomTo( base.top ) val lump = Square(size.x+ wallThickness*2, lumpHeight*2) .smartExtrude(lumpHeight).top(ProfileEdge.chamfer(lumpHeight-0.1)) .bottomTo( base.top ) .centerX() .centerYTo( size.y/2 ) val screwHoles = Countersink() .topTo( baseThickness ) .centerYTo( size.y * 0.25 ) .translateY( size.y * 0.5 ).also() return base + main - screwHoles + lump } @Piece( print="foot" ) override fun build() : Shape3d { val post = Square( size.x, size.y ).centerX() .translateY( wallThickness ) .roundAllCorners(3) .extrude( 400 ) .translateZ( baseThickness ) .previewOnly() val feet = foot() .mirrorZ().topTo( post.top + baseThickness ).also(2) return post + feet } }