Skip to content

Commit

Permalink
remove buggy line_on_line check / add experimental pocket-support
Browse files Browse the repository at this point in the history
  • Loading branch information
multigcs committed Sep 22, 2014
1 parent ac2afb6 commit 80d98d9
Show file tree
Hide file tree
Showing 7 changed files with 3,006 additions and 2,818 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ CFLAGS+="-DUSE_POSTCAM"

all: cammill

cammill: main.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c dxf.h font.c font.h texture.c
cammill: main.c pocket.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c dxf.h font.c font.h texture.c
msgfmt de.po -o intl/de_DE.UTF-8/LC_MESSAGES/cammill.mo
clang -ggdb -Wall -O3 -o cammill main.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c font.c texture.c ${LIBS} ${INCLUDES} ${CFLAGS}
clang -ggdb -Wall -O3 -o cammill main.c pocket.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c font.c texture.c ${LIBS} ${INCLUDES} ${CFLAGS}

gprof:
gcc -pg -ggdb -Wall -O3 -o cammill main.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c font.c texture.c ${LIBS} ${INCLUDES} ${CFLAGS}
gcc -pg -ggdb -Wall -O3 -o cammill main.c pocket.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c font.c texture.c ${LIBS} ${INCLUDES} ${CFLAGS}
@echo "./cammill"
@echo "gprof cammill gmon.out"

Expand Down
4 changes: 2 additions & 2 deletions Makefile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ CFLAGS+="-DUSE_POSTCAM"

all: cammill

cammill: main.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c dxf.h font.c font.h texture.c
clang -Wall -O3 -o cammill main.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c font.c texture.c ${LIBS} ${INCLUDES} -DOSX ${CFLAGS}
cammill: main.c pocket.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c dxf.h font.c font.h texture.c
clang -Wall -O3 -o cammill main.c pocket.c calc.c hersheyfont.c postprocessor.c setup.c dxf.c font.c texture.c ${LIBS} ${INCLUDES} -DOSX ${CFLAGS}

clean:
rm -rf cammill
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Homepage: http://www.multixmedia.org/cammill/
--------------------------------------------------------------------
To compile under Linux (Debian/Wheezy):
--------------------------------------------------------------------
apt-get install libgtkglext1-dev libgtksourceview2.0-dev liblua5.1-0-dev freeglut3-dev libglu1-mesa-dev libgtk2.0-dev libgvnc-1.0-dev
apt-get install clang libgtkglext1-dev libgtksourceview2.0-dev liblua5.1-0-dev freeglut3-dev libglu1-mesa-dev libgtk2.0-dev libgvnc-1.0-dev

git clone https://github.com/multigcs/cammill.git
cd cammill
Expand Down
24 changes: 19 additions & 5 deletions calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include <setup.h>
#include <postprocessor.h>
#include <calc.h>
#include <pocket.h>

extern float size_x;
extern float size_y;
Expand Down Expand Up @@ -1041,11 +1042,18 @@ void mill_objects (void) {
} else if (myOBJECTS[object_num].closed == 1) {
if (myOBJECTS[object_num].inside == 1) {
myOBJECTS[object_num].offset = OFFSET_INSIDE;
if (strstr(myOBJECTS[object_num].layer, "do_pocket") > 0) {
myOBJECTS[object_num].pocket = 1;
} else {
myOBJECTS[object_num].pocket = PARAMETER[P_M_POCKET].vint;
}
} else {
myOBJECTS[object_num].offset = OFFSET_OUTSIDE;
myOBJECTS[object_num].pocket = 0;
}
} else {
myOBJECTS[object_num].offset = OFFSET_NONE;
myOBJECTS[object_num].pocket = 0;
}
}
}
Expand Down Expand Up @@ -2001,6 +2009,7 @@ void object_draw (FILE *fd_out, int object_num) {
}
return;
}

for (num = 0; num < line_last; num++) {
if (myOBJECTS[object_num].line[num] != 0) {
int lnum = myOBJECTS[object_num].line[num];
Expand Down Expand Up @@ -2428,6 +2437,11 @@ void object_draw_offset (FILE *fd_out, int object_num, double *next_x, double *n
return;
}

if (myOBJECTS[object_num].pocket == 1) {
mill_pocket(object_num);
}


#ifdef USE_POSTCAM
postcam_comment("--------------------------------------------------");
sprintf(cline, "Object: #%i", object_num);
Expand Down Expand Up @@ -2999,13 +3013,13 @@ void remove_double_lines (void) {
} else if (PointOnLine(myLINES[num].x1, myLINES[num].y1, myLINES[num].x2, myLINES[num].y2, myLINES[num2].x1, myLINES[num2].y1) == 1 && PointOnLine(myLINES[num].x1, myLINES[num].y1, myLINES[num].x2, myLINES[num].y2, myLINES[num2].x2, myLINES[num2].y2) == 1) {
float len1 = get_len(myLINES[num].x1, myLINES[num].y1, myLINES[num].x2, myLINES[num].y2);
float len2 = get_len(myLINES[num2].x1, myLINES[num2].y1, myLINES[num2].x2, myLINES[num2].y2);
printf("found line on line: %i(%f) <-> %i(%f)\n", num, len1, num2, len2);
// printf("found line on line: %i(%f) <-> %i(%f)\n", num, len1, num2, len2);
if (len1 > len2) {
myLINES[num2].marked = 1;
myLINES[num2].used = 0;
// myLINES[num2].marked = 1;
// myLINES[num2].used = 0;
} else {
myLINES[num].marked = 1;
myLINES[num].used = 0;
// myLINES[num].marked = 1;
// myLINES[num].used = 0;
}
}
} else if (myLINES[num2].used == 1 && ((myLINES[num2].type == TYPE_ARC && myLINES[num].type == TYPE_ARC) || (myLINES[num2].type == TYPE_CIRCLE && myLINES[num].type == TYPE_CIRCLE))) {
Expand Down
1 change: 1 addition & 0 deletions setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ PARA PARAMETER[] = {
{"Lasermode", "Milling", "-lm", T_BOOL , 0, 0.0, 0.0, "", 0.0, 1.0, 1.0, "", 1, 1, "lasermode, depth=0.0, turn on/off per object", 0, 0, 0},
{"Climb", "Milling", "-mr", T_BOOL , 0, 0.0, 0.0, "", 0.0, 1.0, 1.0, "", 1, 1, "reverse milling direction / climb milling", 0, 0, 0},
{"NoOffsets", "Milling", "-no", T_BOOL , 0, 0.0, 0.0, "", 0.0, 1.0, 1.0, "", 1, 1, "without tool-offsets", 0, 0, 0},
{"Pocket", "Milling", "-mp", T_BOOL , 0, 0.0, 0.0, "", 0.0, 1.0, 1.0, "", 1, 1, "mill pockets inside", 0, 0, 0},
{"Velocity-Mode","Milling", "-vm", T_BOOL, 0, 0.0, 0.0, "", 0.0, 1.0, 1.0, "", 1, 1, "Velocity-Mode G61/G64 P...", 0, 0, 0},
{"Blending Tolerance","Milling","-bt", T_DOUBLE, 0, 0.0, 0.05, "", 0.0, 0.01, 10.0, "mm", 1, 1, "Blending Tolerance G64 P?", 0, 0, 0},
{"Mill Text", "Milling", "-mt", T_BOOL , 0, 0.0, 0.0, "", 0.0, 1.0, 1.0, "", 1, 1, "mill mtext from dxf-files", 0, 0, 0},
Expand Down
1 change: 1 addition & 0 deletions setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ enum {
P_M_LASERMODE,
P_M_CLIMB,
P_M_NOOFFSET,
P_M_POCKET,
P_M_VELOCITYMODE,
P_M_BLENDINGTOLERANCE,
P_M_TEXT,
Expand Down
Loading

0 comments on commit 80d98d9

Please sign in to comment.