-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpositem.h
139 lines (125 loc) · 4.39 KB
/
positem.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
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef POSITEM_H
#define POSITEM_H
#include <QMetaType>
#include <QtGui>
#include "stdint.h"
#include "definitions.h"
/// T4 uses z, k, p
class PosItem
{
public:
/// 1- visu XY
/// constructor 2 axes
PosItem(double x1, double y1)
: x(x1), y(y1), i(0), j(0),
arc(false), cw(false), mm(true), index(0) {}
PosItem(double x1, double y1, double i1, double j1)
: x(x1), y(y1), i(i1), j(j1),
arc(false), cw(false), mm(true), index(0) {}
PosItem(double x1, double y1, double i1, double j1, bool arc1, bool cw1, bool mm1, int index1)
: x(x1), y(y1), i(i1), j(j1),
arc(arc1), cw(cw1), mm(mm1), index(index1) {}
void setCoords(double x1, double y1, double i1, double j1);
void setCoords(double x1, double y1, bool mm);
void expand(const PosItem& item);
double width() { return qAbs(i - x); }
double height() { return qAbs(j - y); }
bool isNull() { return x == 0 && y == 0 && i == 0 && j == 0 && arc == false && cw == false && index == 0; }
/// 2- visu XYZ
/// constructor 2, 3 axes
PosItem()
: x(0), y(0), z(0),
i(0), j(0), k(0) ,
p(0), arc(false), cw(true),
mm(true), g(0),
plane(PLANE_XY_G17), helix(false),
index(0), feedrate(0)
{}
/// constructeur 3 axes
PosItem(double x1, double y1, double z1)
: x(x1), y(y1), z(z1), i(0), j(0), k(0), p(0),
arc(false), cw(false), mm(true), g(0), plane(0), index() {}
/// constructeur 3 axes
PosItem(double x1, double y1, double z1, double i1, double j1, double k1)
: x(x1), y(y1), z(z1), i(i1), j(j1), k(k1) ,
arc(false), cw(false), mm(true), g(0), plane(0), index(0) {}
/// T4
/// constructeur 3 axes with real
PosItem(double x1, double y1, double z1,
double i1, double j1, double k1,
int pr1, bool arc1, bool cw1,
bool mm1, int g1,
int pl, bool hel, int index1, double f
)
: x(x1), y(y1), z(z1),
i(i1), j(j1), k(k1) ,
p(pr1), arc(arc1), cw(cw1),
mm(mm1), g(g1),
plane(pl), helix(hel), index(index1) , feedrate(f) {}
/// + line gcode
PosItem(QString linecode,
double x1, double y1, double z1,
double i1, double j1, double k1,
int pr1, bool arc1, bool cw1,
bool mm1, int g1,
int pl, bool hel , int index1, double f
)
: line(linecode),
x(x1), y(y1), z(z1),
i(i1), j(j1), k(k1) ,
p(pr1), arc(arc1), cw(cw1),
mm(mm1), g(g1),
plane(pl), helix(hel), index(index1), feedrate(f) {}
/// constructeur 3 axes with Vector
PosItem(QVector3D xyz,
QVector3D ijk,
int pr1, bool arc1, bool cw1,
bool mm1, int g1,
int pl, bool hel,
int index1, double f1, double s1
)
: x(xyz.x()), y(xyz.y()), z(xyz.z()),
i(ijk.x()), j(ijk.y()), k(ijk.z()),
p(pr1), arc(arc1), cw(cw1),
mm(mm1), g(g1),
plane(pl), helix(hel), index(index1) , feedrate (f1), speedspindle(s1) {}
/// constructeur 3 axes with Vector + line gcode
PosItem( QString linecode,
QVector3D xyz,
QVector3D ijk,
int pr1, bool arc1, bool cw1,
bool mm1, int g1,
int pl, bool hel,
int index1 , double f1, double s1
)
: line(linecode),
x(xyz.x()), y(xyz.y()), z(xyz.z()),
i(ijk.x()), j(ijk.y()), k(ijk.z()),
p(pr1), arc(arc1), cw(cw1),
mm(mm1), g(g1),
plane(pl), helix(hel), index(index1) , feedrate(f1), speedspindle(s1) {}
void setCoords(double x1, double y1, double z1, double i1, double j1, double k1);
void setCoords(QVector3D xyz1, QVector3D ijk1);
void setCoords(double x1, double y1, double z1, bool mm);
/// T4
void toMm();
void toInches();
public:
QString line;
double x, y, z;
double i, j, k;
int p; // arc revolutions
bool arc ;
bool cw;
bool mm;
int g; // in [0..3] for Gx
/// T4
int plane;
bool helix;
// ligne GCode
int index;
double feedrate;
double speedspindle ;
};
Q_DECLARE_METATYPE ( PosItem )
#endif // POSITEM_H