Ultimaker / Cura

3D printer / slicing GUI built on top of the Uranium framework
GNU Lesser General Public License v3.0
6.16k stars 2.07k forks source link

[4.0.0] Generated GCode has illegal newline in line comments #5794

Closed lukehutch closed 5 years ago

lukehutch commented 5 years ago

The gcode generated from Cura has illegal linebreaks in the middle of a comments: (two examples shown below)

G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle
to release some of the pressure
G1 Z+0.5 E-5 ;X-20 Y-20 F100 ;move Z up a bit and retract filament even more
G28 X0 ;Y0 ;move X/Y to min endstops
so the head is out of the way

Application Version

4.0.0

Platform

Linux

Printer

Anycubic i3 Mega

Steps to Reproduce

Generate gcode from STL

Actual Results

See above

Expected results

Comments should not contain newlines

Additional Information

fieldOfView commented 5 years ago

Looks like somewhere a comma followed by a space is replaced by a newline. You wouldn't have a Search and Replace postprocessing script active by any chance?

lukehutch commented 5 years ago

No, I'm just using Cura straight out of the box, freshly downloaded from the website. I only spotted this because I was curious what the generated gcode looked like.

Ghostkeeper commented 5 years ago

I'm unable to reproduce this issue. This is what those lines look like when I slice something with Anycubic i3 Mega:

G91 ;relative positioning
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 ;X-20 Y-20 F100 ;move Z up a bit and retract filament even more
G28 X0 ;Y0 ;move X/Y to min endstops, so the head is out of the way

Also in the source code there are no newlines in that position.

Are you sure it's not your editor that displays it like that or something? It has nice pretty newlines at word breaks instead of a hard border at 80 characters.

Maybe you could provide a project file?

lukehutch commented 5 years ago

The linebreaks are definitely there -- I viewed with both gedit and emacs, and they have the breaks in the same place in both editors. They are hard linebreaks, not soft linebreaks.

Also, the linebreaks are not apparently the result of line wrapping, since the break is in a different place each time.

Here are the input STL and the output gcode files.

partfiles.zip

Ghostkeeper commented 5 years ago

Yeah I sliced that file but it's not producing the newlines for me.

What I need is a project file. Please go to File -> Save... and zip up the .3mf file you get from that. It'll contain all of your settings and post-processing scripts so it should completely reproduce the exact g-code you're getting.

lukehutch commented 5 years ago

I can't reproduce this on 4.1.0, so maybe this is fixed now. But I can reliably reproduce it on 4.0.0, so I'll attach my project here, in case the problem is not actually fixed, but somehow isn't triggered in 4.1.0.

Here is my project... it looks like a 3mf file is actually a zipfile anyway, so zipping it again doesn't make it much smaller :-)

project.zip

Ghostkeeper commented 5 years ago

Ah, I see it now. Indeed the problem reproduces in Cura 4.0. This end g-code was actually in the 4.0 release with the newlines.

Someone else also discovered this and fixed it for us: https://github.com/Ultimaker/Cura/pull/5594