> One thing which I've become curious about --- could one use OpenSCAD as a previewer for a CNC toolpath? Given an arbitrary shape (the tool definition) could one then subtract from the stock that shape moving along a path? Forgive me if there's some obvious command for this (just point me at the manual and I'll try to understand it better).

One way to generate the toolpath would be taking the cutter geometry,

and doing the hull on each consecutive pair of points along the tool

path, then union all those, and subtract from your model. This could

end up becoming extremely computationally expensive depending on your

paths and the detail of your cutter geometry (ball end geometry much

more complex than straight end mill).

I've needed this sort of operation in the past, and I've dubbed it the

"consecutive hull" operation. Here is a demo script for it:

module consecutive_hull() {

for (i = [1:1:$children-1])

hull() {

children(i-1);

children(i);

}

}

count = 25;

$fn=20;

xs = rands(-100,100,count);

ys = rands(-100,100,count);

zs = rands(-100,100,count);

ss = rands(-100,100,count);

consecutive_hull() {

// using loops isnt compatible with children() module used by consecutive hull

//for(i = [0:1:count-1])

// translate([xs[i],ys[i],zs[i]]) sphere(5);

// must define each child explicitly

let(i = 0) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 1) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 2) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 3) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 4) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 5) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 6) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 7) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 8) translate([xs[i],ys[i],zs[i]]) sphere(5);

let(i = 9) translate([xs[i],ys[i],zs[i]]) sphere(5);

}

This could also conceptually be thought of as a sort of minkowski sum

between a 3d shape(the cutter geometry) and a 1D shape (a linear path

which exists in 3D space).

OpenSCAD minkowski currently only supports summing 3D objects with 3D,

or 2D with 2D. No mixing 2D and 3D, and not really even the concept

of 1D geometries (paths / curves), though you can always make a vector

of points to represent such things.

I think a more comprehensive native minkowski operation including 1D

paths (as well as some ways of summing 2D with 3D) could be a very

useful addition to OpenSCAD if an efficient implementation is

possible.

_______________________________________________

OpenSCAD mailing list

[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org