CAM: Simulator - Drilling - RetractMode G98/G99
This commit is contained in:
@@ -41,7 +41,7 @@ GCodeParser::~GCodeParser()
|
||||
bool GCodeParser::Parse(const char* filename)
|
||||
{
|
||||
Operations.clear();
|
||||
lastState = {eNop, -1, 0, 0, 0, 0, 0, 0, 0};
|
||||
lastState = {eNop, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
lastTool = -1;
|
||||
|
||||
FILE* fl;
|
||||
@@ -163,6 +163,13 @@ bool GCodeParser::ParseLine(const char* ptr)
|
||||
}
|
||||
else if (cmd == 73 || cmd == 81 || cmd == 82 || cmd == 83) {
|
||||
lastState.cmd = eDril;
|
||||
lastState.retract_z = lastState.z;
|
||||
}
|
||||
else if (cmd == 98 || cmd == 99) {
|
||||
lastState.retract_mode = cmd;
|
||||
}
|
||||
else if (cmd == 80) {
|
||||
lastState.retract_mode = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -212,7 +219,13 @@ bool GCodeParser::AddLine(const char* ptr)
|
||||
if (lastState.cmd == eDril) {
|
||||
// split to several motions
|
||||
lastState.cmd = eMoveLiner;
|
||||
float rPlane = lastState.r;
|
||||
float rPlane;
|
||||
if (lastState.retract_mode == 99) {
|
||||
rPlane = lastState.r;
|
||||
}
|
||||
else {
|
||||
rPlane = lastState.retract_z;
|
||||
}
|
||||
float finalDepth = lastState.z;
|
||||
lastState.z = rPlane;
|
||||
Operations.push_back(lastState);
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
|
||||
public:
|
||||
std::vector<MillMotion> Operations;
|
||||
MillMotion lastState = {eNop, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
MillMotion lastLastState = {eNop, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
MillMotion lastState = {eNop, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
MillMotion lastLastState = {eNop, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
protected:
|
||||
const char* GetNextToken(const char* ptr, GCToken* token);
|
||||
|
||||
@@ -53,6 +53,8 @@ struct MillMotion
|
||||
float x, y, z;
|
||||
float i, j, k;
|
||||
float r;
|
||||
char retract_mode;
|
||||
float retract_z;
|
||||
};
|
||||
|
||||
static inline void MotionPosToVec(vec3 vec, const MillMotion* motion)
|
||||
|
||||
Reference in New Issue
Block a user