Stefan Schuermans commited on 2013-01-28 21:14:28
Showing 4 changed files, with 17 additions and 14 deletions.
| ... | ... |
@@ -116,8 +116,18 @@ void Layer::improvePaths(double eqDist) |
| 116 | 116 |
*/ |
| 117 | 117 |
void Layer::toGCode(const Settings &settings, GCode &gcode) const |
| 118 | 118 |
{
|
| 119 |
+ // cut step-wise |
|
| 120 |
+ double z = settings.base_z; |
|
| 121 |
+ do {
|
|
| 122 |
+ z -= settings.cut_z_step; |
|
| 123 |
+ if (z < settings.cut_z) |
|
| 124 |
+ z = settings.cut_z; |
|
| 125 |
+ |
|
| 126 |
+ // cut path at current z |
|
| 119 | 127 |
Paths::const_iterator path; |
| 120 | 128 |
for (path = mPaths.begin(); path != mPaths.end(); ++path) |
| 121 |
- path->toGCode(settings, gcode); |
|
| 129 |
+ path->toGCode(settings, z, gcode); |
|
| 130 |
+ |
|
| 131 |
+ } while (z > settings.cut_z); |
|
| 122 | 132 |
} |
| 123 | 133 |
|
| ... | ... |
@@ -88,9 +88,10 @@ void Path::removeEqPoints(double eqDist) |
| 88 | 88 |
/** |
| 89 | 89 |
* @brief convert path to G-code |
| 90 | 90 |
* @param[in] settings G-code creation settings |
| 91 |
+ * @param[in] z z coordinate to use for G-code of path |
|
| 91 | 92 |
* @param[in,out] gcode new G-code is appended to existing G-code |
| 92 | 93 |
*/ |
| 93 |
-void Path::toGCode(const Settings &settings, GCode &gcode) const |
|
| 94 |
+void Path::toGCode(const Settings &settings, double z, GCode &gcode) const |
|
| 94 | 95 |
{
|
| 95 | 96 |
// leave if no points |
| 96 | 97 |
if (mPoints.empty()) |
| ... | ... |
@@ -99,13 +100,6 @@ void Path::toGCode(const Settings &settings, GCode &gcode) const |
| 99 | 100 |
// move up |
| 100 | 101 |
gcode.appendUp(settings.move_z); |
| 101 | 102 |
|
| 102 |
- // cut step-wise |
|
| 103 |
- double z = settings.base_z; |
|
| 104 |
- do {
|
|
| 105 |
- z -= settings.cut_z_step; |
|
| 106 |
- if (z < settings.cut_z) |
|
| 107 |
- z = settings.cut_z; |
|
| 108 |
- |
|
| 109 | 103 |
// move to start |
| 110 | 104 |
gcode.appendFast(mPoints.front()); |
| 111 | 105 |
|
| ... | ... |
@@ -121,7 +115,5 @@ void Path::toGCode(const Settings &settings, GCode &gcode) const |
| 121 | 115 |
|
| 122 | 116 |
// move up |
| 123 | 117 |
gcode.appendUp(settings.move_z); |
| 124 |
- |
|
| 125 |
- } while (z > settings.cut_z); |
|
| 126 | 118 |
} |
| 127 | 119 |
|
| ... | ... |
@@ -63,9 +63,10 @@ public: |
| 63 | 63 |
/** |
| 64 | 64 |
* @brief convert path to G-code |
| 65 | 65 |
* @param[in] settings G-code creation settings |
| 66 |
+ * @param[in] z z coordinate to use for G-code of path |
|
| 66 | 67 |
* @param[in,out] gcode new G-code is appended to existing G-code |
| 67 | 68 |
*/ |
| 68 |
- void toGCode(const Settings &settings, GCode &gcode) const; |
|
| 69 |
+ void toGCode(const Settings &settings, double z, GCode &gcode) const; |
|
| 69 | 70 |
|
| 70 | 71 |
Points mPoints; ///< points of path |
| 71 | 72 |
}; |
| 72 | 73 |