Skip to content

Commit

Permalink
fix(gcodepreview): ignore moves without coordinates (#1416)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas authored Apr 13, 2024
1 parent 8ad71bc commit 8748e16
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/components/widgets/gcode-preview/GcodePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
</g>

<g
v-if="getViewerOption('showRetractions') && svgPathCurrent.retractions.length > 0"
v-if="getViewerOption('showRetractions') && svgPathCurrent.extrusionStarts.length > 0"
id="extrusionStarts"
>
<use
Expand Down
44 changes: 26 additions & 18 deletions src/workers/parseGcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,35 @@ const parseGcode = (gcode: string, sendProgress: (filePosition: number) => void)
} else if (type === 'gcode') {
switch (command) {
case 'G0':
case 'G1':
move = {
...pick(args, [
'x', 'y', 'z', 'e'
]),
filePosition: toolhead.filePosition
} satisfies LinearMove
case 'G1': {
const values = pick(args, [
'x', 'y', 'z', 'e'
])
if (Object.keys(values).length) {
move = {
...values,
filePosition: toolhead.filePosition
} satisfies LinearMove
}
break
}
case 'G2':
case 'G3':
move = {
...pick(args, [
'x', 'y', 'z', 'e',
'i', 'j', 'k', 'r'
]),
direction: command === 'G2'
? 'clockwise'
: 'counter-clockwise',
filePosition: toolhead.filePosition
} satisfies ArcMove
case 'G3': {
const values = pick(args, [
'x', 'y', 'z', 'e',
'i', 'j', 'k', 'r'
])
if (Object.keys(values).length) {
move = {
...values,
direction: command === 'G2'
? 'clockwise'
: 'counter-clockwise',
filePosition: toolhead.filePosition
} satisfies ArcMove
}
break
}
case 'G10':
move = {
e: -fwretraction.length,
Expand Down

0 comments on commit 8748e16

Please sign in to comment.