mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2025-04-21 12:27:27 +03:00
cameo: adding support for dril/mill substitutions (in progress)
- Makefile (OBJS): added shape.o - README: added section for drill/mill substitutions - lang.l, lang.y: added commands "drill", "empty", "mill", "remainder", and "reset" - lang.y (clear_paths): moved freeing of all paths from "clean" to shared function clear_paths - ops.h, ops.c (try_drill, try_mill): helper functions for "drill" and "mill" commands - shape.h. shape.c (slot, circle): functions to generate toolpaths for basic shapes
This commit is contained in:
34
cameo/ops.c
34
cameo/ops.c
@@ -11,7 +11,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "path.h"
|
||||
#include "shape.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
@@ -54,3 +57,34 @@ void tool_comp_paths(struct path *paths, int dog_bone, int all_inside)
|
||||
tool_comp_1(path, 0, dog_bone);
|
||||
tool_comp_1(leftmost, !all_inside, dog_bone);
|
||||
}
|
||||
|
||||
|
||||
struct path *try_drill(struct path *path, double d_min, double d_max)
|
||||
{
|
||||
struct path *new;
|
||||
|
||||
if (path->r_tool*2 < d_min || path->r_tool*2 > d_max)
|
||||
return NULL;
|
||||
if (!path->first || path->first != path->last)
|
||||
return NULL;
|
||||
new = path_new((d_min+d_max)/2); /* @@@ fishy */
|
||||
path_add(new, path->first->x, path->first->y, path->first->z);
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
struct path *try_mill(struct path *path, double diam, double step)
|
||||
{
|
||||
if (path->r_tool*2 < diam)
|
||||
return NULL;
|
||||
if (!path->first)
|
||||
return NULL;
|
||||
if (path->first == path->last)
|
||||
return circle(path->first->x, path->first->y, path->first->z,
|
||||
path->r_tool, diam/2, step);
|
||||
if (path->first->next == path->last)
|
||||
return slot(path->first->x, path->first->y,
|
||||
path->first->next->x, path->first->next->y,
|
||||
path->first->z, path->r_tool, diam/2, step);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user