add a bottom lol
This commit is contained in:
parent
a998e4dd67
commit
0df0762067
|
@ -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)
|
||||
|
|
Binary file not shown.
|
@ -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")
|
||||
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())
|
||||
|
||||
for k, v := range parts {
|
||||
render.RenderDXF(v.SDF2, 400, k+".dxf")
|
||||
render.ToSTL(v.SDF3, 400, k+".stl", dc.NewDualContouringDefault())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue