|
1 | 1 | import { Path, PathType } from './path'; |
2 | 2 | import { GCodeCommand } from './gcode-parser'; |
3 | 3 | import { Job } from './job'; |
| 4 | +import { GCodeVector3 } from './types'; |
4 | 5 |
|
5 | 6 | // eslint-disable-next-line no-unused-vars |
6 | 7 | type Method = (...args: unknown[]) => unknown; |
@@ -113,9 +114,9 @@ export class Interpreter { |
113 | 114 | state.y = y ?? state.y; |
114 | 115 | state.z = z ?? state.z; |
115 | 116 |
|
116 | | - currentPath.addPoint(state.x, state.y, state.z); |
| 117 | + currentPath.addPoint(state.toGCodeVector3()); |
117 | 118 | if (pathType === PathType.Extrusion) { |
118 | | - job.boundingBox.update(state.x, state.y, state.z); |
| 119 | + job.boundingBox.update(state.toGCodeVector3()); |
119 | 120 | } |
120 | 121 | } |
121 | 122 |
|
@@ -220,19 +221,19 @@ export class Interpreter { |
220 | 221 | px = centerX + arcRadius * Math.cos(currentAngle); |
221 | 222 | py = centerY + arcRadius * Math.sin(currentAngle); |
222 | 223 | pz += zStep; |
223 | | - currentPath.addPoint(px, py, pz); |
| 224 | + currentPath.addPoint(new GCodeVector3(px, py, pz)); |
224 | 225 | if (pathType === PathType.Extrusion) { |
225 | | - job.boundingBox.update(px, py, pz); |
| 226 | + job.boundingBox.update(new GCodeVector3(px, py, pz)); |
226 | 227 | } |
227 | 228 | } |
228 | 229 |
|
229 | 230 | state.x = x || state.x; |
230 | 231 | state.y = y || state.y; |
231 | 232 | state.z = z || state.z; |
232 | 233 |
|
233 | | - currentPath.addPoint(state.x, state.y, state.z); |
| 234 | + currentPath.addPoint(state.toGCodeVector3()); |
234 | 235 | if (pathType === PathType.Extrusion) { |
235 | | - job.boundingBox.update(state.x, state.y, state.z); |
| 236 | + job.boundingBox.update(state.toGCodeVector3()); |
236 | 237 | } |
237 | 238 | } |
238 | 239 |
|
@@ -371,7 +372,7 @@ export class Interpreter { |
371 | 372 | private breakPath(job: Job, newType: PathType): Path { |
372 | 373 | job.finishPath(); |
373 | 374 | const currentPath = new Path(newType, 0.6, 0.2, job.state.tool); |
374 | | - currentPath.addPoint(job.state.x, job.state.y, job.state.z); |
| 375 | + currentPath.addPoint(job.state.toGCodeVector3()); |
375 | 376 | job.inprogressPath = currentPath; |
376 | 377 | return currentPath; |
377 | 378 | } |
|
0 commit comments