MoonCactus / gcode_postprocessors

Some g-code post-processors for 3D printing. This repository hosts the "famous" wood pattern.
106 stars 51 forks source link

Wood.py: For Cura, lastPatchZ being incorrectly set #5

Closed semussan closed 4 years ago

semussan commented 5 years ago

For wood.py, when processing a gcode produced by the current cura, lastPatchZ is being set to an incorrect value. This causes the noisy texture to only be applied to a portion of the print (20mm up for me). Attached is the gcode the produces the error CE3_2xbedguard v1.zip

I understand this piece of cura's gcode at the end of the script causes lastPatchZ to be overwritten with a small value of 20:

G91 ; Set coordinates to relative
G1 F1800 E-3 ; Retract filament 3 mm to prevent oozing
G1 F3000 Z20 ; Move Z Axis up 20 mm to allow filament ooze freely

The relative Z20 manuever is the last maneuver seen in the file, so lastPatchZ is overwritten with 20.

I was able to solve this problem by changing these lines:

    elif abs(thisZ - formerZ) > minimumChangeZ and thisZ > skipStartZ:
        formerZ = thisZ

to this:

    elif abs(thisZ - formerZ) > minimumChangeZ and thisZ > skipStartZ:
        if thisZ > formerZ:
            formerZ = thisZ
MoonCactus commented 5 years ago

Thanks & sorry for the awfully late answer!

I understand you were running the script via Python & command-line, right? May I ask which version of Cura produced this issue?

Anyhow, I will have look with latest Cura 4.0.0 beta, I must say that I did not use the script for years. So double thanks for suggesting a fix as well :)

It would be cool that Ultimaker stopped breaking their own plugin API... So I might want to "fix" it as a valid plugin again. One of their latest moves looks like we need to get initial approval.

MoonCactus commented 4 years ago

Awfully sorry for tackling this so late, but you were perfectly right. Cura going down at the end of the print provoked some issue. I just committed a fix and got rid of lastLatchZ actually (less code is less bugs). Thanks again in the first place!