-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.h
127 lines (89 loc) · 3.17 KB
/
post.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
post.h
This is part of pcb2g - pcb bitmap to G code converter
Copyright (C) 2011- 2015 Peter Popovec, popovec@fei.tuke.sk
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Postprocesor wrapper functions (headers)
*/
struct postprocesor
{
char *name;
void *data;
struct post_operations *ops;
struct postprocesor *next;
void *module;
};
enum POST_MACHINE_OPS
{
MACHINE_IDLE,
MACHINE_SETUP,
MACHINE_ETCH,
MACHINE_DRILL,
MACHINE_CUT,
MACHINE_END,
};
enum POST_SET
{
POST_SET_X,
POST_SET_Y,
POST_SET_CUT,
POST_SET_ETCH,
POST_SET_ROUTE_RETRACT,
POST_SET_HOLE_RETRACT,
POST_SET_SAFE_TRAVERSE,
POST_SET_CUTTER_COMP
};
/*
calling operations order:
open,
machine_operation(SETUP)
machine_operation(ETCH)
write_comment/spindle/rapid/route in mixed order (for etching)
machine_operation(IDLE)
machine_operation(DRILL)
write_comment/spindle/hole in mixed order (for drilling)
machine_operation(IDLE)
machine_operation(CUT)
write_comment/spindle/rapid/route in mixed order (for edge cuts)
machine_operation(IDLE)
machine_operation(END)
close
*/
struct post_operations
{
void (*open) (struct postprocesor *, char *filename); //set filename and open postprocesor output ..
void (*close) (struct postprocesor *); //close postprocesor output
void (*set) (struct postprocesor *, enum POST_SET op, va_list ap);
void (*operation) (struct postprocesor *, enum POST_MACHINE_OPS op);
void (*write_comment) (struct postprocesor *, char *);
void (*route) (struct postprocesor *, double x, double y);
void (*rapid) (struct postprocesor *, double x, double y);
void (*route_arc) (struct postprocesor *, double x, double y, double cx, double cy, int dir);
void (*hole) (struct postprocesor *, double x, double y, double dia);
};
struct postprocesor *postprocesor_register (struct post_operations *p,
void *data, char *name);
void postprocesor_init (void);
void postprocesor_open (char *filename);
void postprocesor_close (void);
void postprocesor_set(enum POST_SET op,...);
void postprocesor_set_dim(double x, double y);
void postprocesor_operation (enum POST_MACHINE_OPS op);
void postprocesor_write_comment (char *comment);
#ifdef _GNU_SOURCE
#define P_COMMENT(c,...) {char *tmp;asprintf(&tmp,c,__VA_ARGS__);postprocesor_write_comment(tmp);free(tmp);}
#endif
//void postprocesor_write_header (char *header);
void postprocesor_route (double x, double y);
void postprocesor_rapid (double x, double y);
void postprocesor_hole (double x, double y, double retract);
void postprocesor_route_arc(double x, double y, double cx, double cy, int dir);