supermerill / SuperSlicer

G-code generator for 3D printers (Prusa, Voron, Creality, etc.)
4.13k stars 520 forks source link

Feature Request: Jerk Setting for Perimter / Infill / First Layer... #237

Open Argolein opened 4 years ago

Argolein commented 4 years ago

This isn't really a new idea as it is a feature in Cura and Ideamaker.

A good position for movement specific jerk values would be in the speed tab next to the acceleration values for Perimeter, Infill etc.

Would also be nice to respect the G-Code flavor. Marlin uses mm/s for jerk, RepRap mm/min.

Whats the benefit? E.g. printing perimeter with 5 mm/s (or 300mm/min) jerk, Infill with 8mm/s jerk, Travel 10 mm/s jerk saves print time.

Picture is from Ideamaker as an example.

image

supermerill commented 4 years ago

M566 (mm/min) for reprapfirmware M207 (mm/s) for repetier other firmware: not possible?

guestisp commented 4 years ago

M205 on Marlin or Lerdge

guestisp commented 4 years ago

But how does this work? Before printing a perimeter, the jerk is changed on the fly?

Also, keep in mind that on Marlin, jerk is deprecated, there is a (better) junction deviation speed and it does not differentiate between x, y or Z

@supermerill what do you think in adding support for junction deviation on Marlin firmware? (M205 J) this could differentiate Marlin flavor and Lerdge flavor a Little bit. I can do a pull request if good for you

supermerill commented 4 years ago

if set, it will write the coresponding gcode at each change of type of extrusion.

what do you think in adding support for junction deviation on Marlin firmware?

what does this mean? what feature I have to wrote?

mmm... jerk seams like a old settings abandoned in all recent firmware due to better planning.

guestisp commented 4 years ago

I'll wrote on my own and submit to you

Argolein commented 4 years ago

I do not have a Marlin 2.0 printer but there is a interesting thread about Junction Deviation it in the Duet forums (RepRap FW):

https://forum.duet3d.com/topic/2629/s-curve-sinusoidal-jerk-acceleration/60?_=1589309512414 (see postings from dc42)

I'm just a newb in coding but if you intend to add the feature, the logic behind it should be easily(?) altered for the corresponding firmware as the firmware (version) only changes the gcode command? The position and such in the gcode file stay the same.

supermerill commented 4 years ago

well, i have to add all these option, add all triggers (and create the way they work) to hide them, modify the gcode writer 'quite a bit' to add these new gcode at the right place, and in a way that is different for every firmware .... Not quick to do.

and if i want to test the result to be sure i don't output garbage gcode ... even worse.

guestisp commented 4 years ago

All of this for something already deprecated and dismissed in Marlin and other firmwares too.

It's like adding feature to support an already outdated firmware. Marlin 2 is the current stable and use junction speed as default

Argolein commented 4 years ago

Still you may want to use different JD settings for inner perimeter, Infill, Solid Fill and so on to save print time.

guestisp commented 4 years ago

I don't think it's the same. JD works differently than jerk and usually you can print faster

Argolein commented 4 years ago

The calculations are different but the results are quite similar: lower cornering speed to reduce ringing / ghosting which is wanted for external perimeters. https://reprap.org/forum/read.php?1,739819

So if you could set a lower value for external perimeters and a higher value for Infill this would also shave off print time especially when printing Infill like Gyroid.

As for time difference I added a picture with time estimation from Ideamaker.

I can't provide you with time estimations for Junction Deviation though because I don't know a Slicer wich knows this feature yet. Maybe Prusa will add it in the future when they add Marlin 2 to their 32 bit printer (Prusa Mini so far) but seeing how long it took them to add LA 1.5. I wouldn't count on it before 2021.

JerkDifference

albert2004 commented 4 years ago

If this is an request to put extra code before each (or some of) of extrusion types, then it is already possible, as solved in issue #108.

Argolein commented 4 years ago

Thanks for pointing this out!

I used all available extrusion roles to specify jerk.


{if extrusion_role=~/.*ExternalPerimeter.*/}M566 X180.00 Y180.00 Z24.00 E300.00               
{elsif extrusion_role=~/.*Perimeter.*/}M566 X360.00 Y360.00 Z24.00 E300.00  
{elsif extrusion_role=~/.*OverhangPerimeter.*/}M566 X360.00 Y360.00 Z24.00 E300.00
{elsif extrusion_role=~/.*InternalInfill.*/}M566 X480.00 Y480.00 Z24.00 E300.00
{elsif extrusion_role=~/.*SolidInfill.*/}M566 X420.00 Y420.00 Z24.00 E300.00
{elsif extrusion_role=~/.*TopSolidInfill.*/}M566 X360.00 Y360.00 Z24.00 E300.00
{elsif extrusion_role=~/.*BridgeInfill.*/}M566 X360.00 Y360.00 Z24.00 E300.00
{elsif extrusion_role=~/.*GapFill.*/}M566 X330.00 Y330.00 Z24.00 E300.00
{elsif extrusion_role=~/.*Skirt.*/}M566 X360.00 Y360.00 Z24.00 E300.00
{elsif extrusion_role=~/.*SupportMaterial.*/}M566 X360.00 Y360.00 Z24.00 E300.00
{elsif extrusion_role=~/.*SupportMaterialInterface.*/}M566 X360.00 Y360.00 Z24.00 E300.00
{elsif extrusion_role=~/.*WipeTower*./}M566 X360.00 Y360.00 Z24.00 E300.00
{else} M566 X480.00 Y480.00 Z24.00 E300.00{endif}

To make things complete the role "Travel" would be nice to have :) Atm it can happen that a travel move move happens after a external perimeter move with it's settings.

Stephan3 commented 4 years ago

+1 for travel role

The only extrusion role thats missing here and covered by else is "Mixed" BTW I made a smal pp as a workarround to the goal @Argolein is trying to achieve. Its a 10 minutes write up. Did the Job so far. You have to turn on detailed gcode for this

launch it like:

C:\Users\Stephan\AppData\Local\Programs\Python\Python38-32\python.exe C:\Users\Stephan\Desktop\SuperSlicer_2.2.52.1_win64_20200703\pp.py

Example for Klipper:


import sys, re, time

output = []

ACCEL = 2500
ACCEL_TO_DECEL = 2500
SQUARE_CORNER_VELOCITY = 5

try:
    with open( sys.argv[1] , 'r' ) as fp:  
        for cnt, line in enumerate(fp):

            if "SET_VELOCITY_LIMIT" in line:
                numbers = re.findall(r'\d+', line)
                ACCEL = numbers[0]
                ACCEL_TO_DECEL = numbers[1]
                SQUARE_CORNER_VELOCITY = numbers[2]

            if "G1 E-" in line:
                output.append("SET_VELOCITY_LIMIT ACCEL=7000  ACCEL_TO_DECEL=7000 SQUARE_CORNER_VELOCITY=10 \n")
                output.append(line)
            elif "G1 E" in line:
                output.append(line)
                output.append("SET_VELOCITY_LIMIT ACCEL="+str(ACCEL)+"  ACCEL_TO_DECEL="+str(ACCEL_TO_DECEL)+" SQUARE_CORNER_VELOCITY="+str(SQUARE_CORNER_VELOCITY)+" \n")
            else:
                output.append(line)

except Exception as e:
    print(e)
    time.sleep(200)

#   overwrite original file
with open( sys.argv[1] , 'w') as f:
    for line in output:
        f.write(line)

EDIT - Script updated after doing things for a week