From bddcf984244521113f6952149d89849521ae9d43 Mon Sep 17 00:00:00 2001 From: Octopus Octopus Date: Fri, 8 Jul 2022 16:09:01 -0500 Subject: [PATCH] start (and abandon) countersunk screws --- fightstick/body3D.go | 18 +++++++++++++++++- fightstick/clusters.go | 29 +++++++++++++++++++++++++++++ fightstick/main.go | 3 +++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/fightstick/body3D.go b/fightstick/body3D.go index d7303fc..520a50d 100644 --- a/fightstick/body3D.go +++ b/fightstick/body3D.go @@ -7,12 +7,28 @@ import ( ) const ( - TOP_HEIGHT = 3.0 + TOP_HEIGHT = 4.0 WALLS_HEIGHT = 45.0 BOTTOM_HEIGHT = 3.0 WALL_NOTCH = 5.0 ) +func top() sdf.SDF3 { + top := sdf.Extrude3D(topPlane(), TOP_HEIGHT) + // screws := sdf.Transform3D(screwCountersinks(), sdf.Translate3d(v3.Vec{X: 0, Y: 0, Z: TOP_HEIGHT/2 - screwCountersinks().BoundingBox().Max.Z})) + // top = sdf.Difference3D(top, screws) + return top +} + +func topLeft() sdf.SDF3 { + return split3DModel(top())[0] +} + +func topRight() sdf.SDF3 { + return split3DModel(top())[1] + +} + // wallFrontRight is the front right wall. This houses the neutrik connector. func wallFrontRight() sdf.SDF3 { corner := wallCorner() diff --git a/fightstick/clusters.go b/fightstick/clusters.go index f1ab42b..dce6a76 100644 --- a/fightstick/clusters.go +++ b/fightstick/clusters.go @@ -5,6 +5,7 @@ import ( "github.com/deadsy/sdfx/sdf" v2 "github.com/deadsy/sdfx/vec/v2" + v3 "github.com/deadsy/sdfx/vec/v3" ) const ( @@ -114,3 +115,31 @@ func screwHoles() sdf.SDF2 { return sdf.Union2D(holes...) } + +// screwHoles produces m4 screwHoles along the sides of the piece. +func screwCountersinks() sdf.SDF3 { + cone, _ := sdf.Cone3D(2.3, M4_SCREW_DIAMETER/2, 7.2/2, 0) + coneCenter, _ := sdf.Cone3D(2.3, M3_SCREW_DIAMETER/2, 5.6/2, 0) + cones := make([]sdf.SDF3, 14) // 1 top + 1 bottom + (1 * 2 corners) + 2 right, + 1 center = 7 for one side, 14 for two sides. + for i := range cones { + cones[i] = cone + } + centerOffset := 3.0 + sideOffset := 4.0 + buffer := 2.5 + // right side + cones[0] = coneCenter + cones[0] = sdf.Transform3D(cones[0], sdf.Translate3d(v3.Vec{X: centerOffset, Y: 0, Z: 0})) + cones[1] = sdf.Transform3D(cones[1], sdf.Translate3d(v3.Vec{X: centerOffset, Y: (BODY_SIZE_Y / 2) - (WALL_THICKNESS / buffer), Z: 0})) + cones[2] = sdf.Transform3D(cones[1], sdf.MirrorXZ()) + cones[3] = sdf.Transform3D(cones[3], sdf.Translate3d(v3.Vec{X: (BODY_SIZE_X / 2) - (WALL_THICKNESS), Y: (BODY_SIZE_Y / 2) - (WALL_THICKNESS), Z: 0})) + cones[4] = sdf.Transform3D(cones[3], sdf.MirrorXZ()) + cones[5] = sdf.Transform3D(cones[5], sdf.Translate3d(v3.Vec{X: (BODY_SIZE_X / 2) - (WALL_THICKNESS / buffer), Y: sideOffset, Z: 0})) + cones[6] = sdf.Transform3D(cones[5], sdf.MirrorXZ()) + + for o := 0; o < len(cones)/2; o++ { + cones[o+len(cones)/2] = sdf.Transform3D(cones[o], sdf.MirrorYZ()) + } + + return sdf.Union3D(cones...) +} diff --git a/fightstick/main.go b/fightstick/main.go index b8a8b82..9faa3bd 100644 --- a/fightstick/main.go +++ b/fightstick/main.go @@ -8,11 +8,14 @@ import ( "github.com/deadsy/sdfx/sdf" ) +// TODO: Figure out countersinks lol func main() { tops := split2DPlane(topPlane()) bottoms := split2DPlane(bottomPlane()) render.RenderDXF(topPlane(), 600, "top.dxf") render.RenderDXF(wallsPlane(), 600, "walls.dxf") + /* render.ToSTL(topLeft(), 400, "topLeft.stl", dc.NewDualContouringDefault()) + render.ToSTL(topLeft(), 400, "topRight.stl", dc.NewDualContouringDefault()) */ render.ToSTL(innerWall(), 400, "innerwall.stl", dc.NewDualContouringDefault()) render.ToSTL(wallFrontRight(), 400, "wallfrontright.stl", dc.NewDualContouringDefault()) render.ToSTL(wallBackLeft(), 400, "wallbackleft.stl", dc.NewDualContouringDefault())