diff --git a/fightstick/body.go b/fightstick/body.go index 8beb682..fc4d7b9 100644 --- a/fightstick/body.go +++ b/fightstick/body.go @@ -8,7 +8,7 @@ import ( const ( BODY_SIZE_X = 300 BODY_SIZE_Y = 215 - BODY_SIZE_Z = 2 + 45 + 0 //Top + Walls + Base + BODY_SIZE_Z = 3 + 45 + 3 //Top + Walls + Base BODY_CURVE = 10 WALL_THICKNESS = 6.9 ) @@ -61,6 +61,15 @@ func wallsPlane() sdf.SDF2 { return walls } +func bottomPlane() sdf.SDF2 { + bottom := sdf.Box2D(v2.Vec{X: BODY_SIZE_X, Y: BODY_SIZE_Y}, BODY_CURVE) + + screws := screwHoles() + bottom = sdf.Difference2D(bottom, screws) + + return bottom +} + // screwHoles produces m4 screwHoles along the sides of the piece. func screwHoles() sdf.SDF2 { hole, _ := sdf.Circle2D(M4_SCREW_DIAMETER / 2) diff --git a/fightstick/fightstick b/fightstick/fightstick index c5f689d..40e0724 100755 Binary files a/fightstick/fightstick and b/fightstick/fightstick differ diff --git a/fightstick/main.go b/fightstick/main.go index b96a9f1..0d190c3 100644 --- a/fightstick/main.go +++ b/fightstick/main.go @@ -1,24 +1,27 @@ package main import ( + "strconv" + "github.com/deadsy/sdfx/render" "github.com/deadsy/sdfx/render/dc" + "github.com/deadsy/sdfx/sdf" ) func main() { - top := topPlane() - walls := wallsPlane() - parts := make(Parts) - parts.add(split2DPlane("top", top, 2)) - parts.add(split2DPlane("walls", walls, 45)) - - render.RenderDXF(top, 600, "top.dxf") + tops := split2DPlane(topPlane()) + walls := split2DPlane(wallsPlane()) + bottoms := split2DPlane(bottomPlane()) + render.RenderDXF(topPlane(), 600, "top.dxf") render.RenderDXF(wallsPlane(), 600, "walls.dxf") - // render.ToSTL(sdf.Extrude3D(walls, 2), 400, "walls.stl", dc.NewDualContouringDefault()) - - for k, v := range parts { - render.RenderDXF(v.SDF2, 400, k+".dxf") - render.ToSTL(v.SDF3, 400, k+".stl", dc.NewDualContouringDefault()) + for i, ele := range tops { + render.ToSTL(sdf.Extrude3D(ele, 3), 400, "top-"+strconv.Itoa(i)+".stl", dc.NewDualContouringDefault()) } - + for i, ele := range walls { + render.ToSTL(sdf.Extrude3D(ele, 45), 400, "wall-"+strconv.Itoa(i)+".stl", dc.NewDualContouringDefault()) + } + for i, ele := range bottoms { + render.ToSTL(sdf.Extrude3D(ele, 3), 400, "bottom-"+strconv.Itoa(i)+".stl", dc.NewDualContouringDefault()) + } + // render.ToSTL(sdf.Extrude3D(walls, 2), 400, "walls.stl", dc.NewDualContouringDefault()) }