last few months of work
[mirrors/Designs.git] / cnc / 3D / g-code.scad
diff --git a/cnc/3D/g-code.scad b/cnc/3D/g-code.scad
new file mode 100644 (file)
index 0000000..d87c8b0
--- /dev/null
@@ -0,0 +1,39 @@
+module tool() {
+    //simulate 1/8'' flat end mill
+    cylinder(20,1.5875,1.5875, $fn=10);
+}
+
+/*
+module tool() {
+    //show toolpaths as thin lines or simulate 3d printer
+    sphere(0.1, $fn=10);
+}
+*/
+
+module path(a, b) {
+    hull() {
+        translate(a) tool();
+        translate(b) tool();
+    }
+}
+
+module gcode(vec) {
+    for(i = [0:len(vec)]) path(vec[i-2],vec[i-1]);
+}
+
+//vector generated from g-code
+vec = [
+[0,0,0],
+[0,0,-10],
+[10,20,-10],
+[20,10,-10],
+[30,10,-10],
+[30,10,0],
+];
+
+difference() {
+    //stock material
+    %translate([-10,-10,-20]) cube([50,40,20]);
+    //object generated from g-code
+    gcode(vec);
+}
\ No newline at end of file
This page took 0.094081 seconds and 4 git commands to generate.