Skip to content
This repository has been archived by the owner on Jan 17, 2018. It is now read-only.

Fixes issue https://github.com/nallath/PostProcessingPlugin/issues/55. #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scripts/PauseAtHeight.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def execute(self, data: list):
prevLayer = data[index - 1]
prevLines = prevLayer.split("\n")
current_e = 0.

# Access last layer, browse it backwards to find
# last extruder absolute position
for prevLine in reversed(prevLines):
current_e = self.getValue(prevLine, 'E', -1)
if current_e >= 0:
Expand All @@ -157,6 +160,19 @@ def execute(self, data: list):
prevLayer = data[index - i]
layer = prevLayer + layer

# Get extruder's absolute position at the
# begining of the first layer redone
# see https://github.com/nallath/PostProcessingPlugin/issues/55
if i == redo_layers:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably going to need to be reset before EVERY layer that's being redone, I think, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about what you mean, but my answer is probably "no".

Let's say your Gcode is as follow (2 layers being redone):

layer n-2
E42
layer n-1
E50
Pause
G92 E42 --> that's what the fix does
layer n-2
E42
layer n-1
E50

Basically my code browses the n layers being redone backwards, finds the first one to be redone, get the extruder position, and resets to that value after the pause.

Gcode with 2 layers being redone to prove it "works":

UO_20mm_hollow_cube.gcode.txt

Before, we had this behavior:

layer n-2
E42
layer n-1
E50
Pause
G92 E50 -> position was reset to last extruder position
layer n-2
E42 -> Retraction !!! (50-42)
layer n-1
E50

prevLines = prevLayer.split("\n")
for line in prevLines:
new_e = self.getValue(line, 'E',
current_e)

if new_e != current_e:
current_e = new_e
break

prepend_gcode = ";TYPE:CUSTOM\n"
prepend_gcode += ";added code by post processing\n"
prepend_gcode += ";script: PauseAtHeight.py\n"
Expand Down