Changing default gcode output
 
Avisos
Vaciar todo

Changing default gcode output  

Página 1 / 3
  RSS
JustMe
(@justme-2)
Active Member
Changing default gcode output

I would like to change a line order in the output file. I know I can do it with a text editor, and I'm doing it this way, but it's a pain in the neck to have to do it every time when it will be so much easier if I could change the default output.

The line I'm talking about is the line that lowers the Z axis to the print height, after the bed and extruder reached their temps, before it moves to the point where the printing starts. I would like it to do that after it arrived at that point.

I really would like not to go into a discussion of it better this way or that, I would only like to know how to change it so that I don't have to do it manually every time.

Respondido : 20/08/2021 12:48 pm
bobstro
(@bobstro)
Illustrious Member
RE: Post processing script is an option

You could do something with a post processing script.

If all you want to do is have the nozzle higher after warmup, do you still want to print the prime line? If so, just raising the nozzle immediately after the prime line is printed should work. If you want to be at the initial start of the print before leveling and warmup, that will be more involved and require some coding.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 20/08/2021 1:09 pm
JustMe
(@justme-2)
Active Member
Topic starter answered:
RE: Post processing

Doing post processing is basically what I do when I use NotePad++ to edit the file. I would like to not have to do it. I would like the gcode to come out ready to print with my flavor without me having to post process it.

Respondido : 20/08/2021 3:19 pm
Ringarn67
(@ringarn67)
Reputable Member

@justme-2

Could you please upload an example, or describe in detail exactly what you want.

I think I know what you mean, and if I am correct I would almost considered it a bug in PS.

Prusa i3 MK3S+ FW 3.11.0 (kit dec -20), PrusaSlicer 2.6.1+win64, Fusion 360, Windows 10

Respondido : 20/08/2021 3:45 pm
bobstro
(@bobstro)
Illustrious Member
Need more info
Posted by: @justme-2

Doing post processing is basically what I do when I use NotePad++ to edit the file. I would like to not have to do it. I would like the gcode to come out ready to print with my flavor without me having to post process it.

Well, you can specify a script to automatically be run for post-processing by the slicer. See Print Settings->Output options->Post-processing scripts. You're still going to have to write the script, of course. There's nothing in PrusaSlicer that will easily do what you've described.

If you'd more fully describe what you're doing, or provide an example gcode file, we might be able to provide better suggestions. A lot depends on the answers to the questions I asked in my original response. 

 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 20/08/2021 4:09 pm
JustMe
(@justme-2)
Active Member
Topic starter answered:
RE: This line

 

In the picture below I highlighted the line in question and the error shows where I want it to be. I do it manually now using NotePad++.

The PLA BN-180 file is the file this is from.

 

PLA BN-180

Respondido : 21/08/2021 12:40 pm
JustMe
(@justme-2)
Active Member
Topic starter answered:
Can't edit???

I wrote 'error' instead of 'arrow' in my above reply but I can't fix it anymore! It says it's too late to do it! Really???

Respondido : 21/08/2021 12:49 pm
Zoltan
(@zoltan)
Miembro Moderator
Re

Let me know, if you can edit now.

even an old man can learn new things 🙂
Standard I3 mk3s, MMU2S, Prusa Enclosure, Fusion 360, PrusaSlicer, Windows 10
PRUSA MINI+ Prusalink + Prusa Connect

Respondido : 21/08/2021 1:10 pm
Ringarn67
(@ringarn67)
Reputable Member

@justme-2

Yes, this is the same thing..... I will go to github and check if I can find something
Stupid to have nozzle go down in Z first, and then X-Y.

Now a little OffTopic from the main question but I think it is related somehow.
This behavior gets even stranger the more you investigate it.
If you do a cube in vase mode, with skirt height set to 0 layers, nozzle will drag across bed to start X-Y, in preview. With Skirt Height > 1 everything is ok.
Saw this line from primeline end to start of cube in PS and thought I investigate it.

And this is G-code, Startup sequence with primeline, Z down to 0, then XY to start point, with Z go up to Z0.05.
With prusa this is not a problem, as prusa won't go lower than 0.2mm. 
But what about other printers? Will they do as they been told?

However, when I run that G-code the printer goes well over the bed, Z0.4 and upwards with a slope from prime line to cube, that's rather strange because G-code says Z0.0???
And even primeline prints with a slope, don't know how printer do it in reality, but numbers on display goes up all the time from start of primeline to start of cube

Could someone help me investigate this
CAREFULLY

Prusa i3 MK3S+ FW 3.11.0 (kit dec -20), PrusaSlicer 2.6.1+win64, Fusion 360, Windows 10

Respondido : 22/08/2021 9:30 am
bobstro
(@bobstro)
Illustrious Member
Need to troubleshoot same settings

Slicer settings can (e.g., z-lift, retraction) can make a big difference in gcode results. It would be best if we're all using the same baseline for comparison. Can you zip & upload a small gcode or 3MF sample to work with?

Here's what I'm seeing with a 0.4mm z-lift specified (a few comments added):

G80 ; mesh bed leveling - Nozzle at 0.15mm
G1 Y-3.0 F1000.0 ; go outside print area
G92 E0.0
G1 X60.0 E9.0 F1000.0 ; intro line
G1 X100.0 E12.5 F1000.0 ; intro line
G92 E0.0
M221 S95

; Don't change E values below. Excessive value can damage the printer.

M907 E538 ; set extruder motor current
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
M900 K0.05 ; Filament gcode LA 1.5
M900 K30 ; Filament gcode LA 1.0
;LAYER_CHANGE
;Z:0.2
;HEIGHT:0.2
;BEFORE_LAYER_CHANGE RLG
G92 E0.0
;0.2


G1 E-0.80000 F2100.000 ; 0.8mm retraction
G1 Z0.400 F10800.000 ; Nozzle raised to 0.4mm (z-lift)
;AFTER_LAYER_CHANGE RLG
;0.2
G1 X109.943 Y91.476
G1 Z0.200 ; Nozzle lowered to 0.2mm (1st layer height)
G1 E0.80000 F2100.000 ; 0.8mm deretraction
M204 S1000
;TYPE:Skirt
;WIDTH:0.42
G1 F1200.000
G1 X110.455 Y90.655 E0.03031 ; Printing starts at 0.2mm
My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 22/08/2021 2:08 pm
JustMe
(@justme-2)
Active Member
Topic starter answered:
Title

No, I can't

Posted by: @zoltan

Let me know, if you can edit now.

 

Respondido : 22/08/2021 2:14 pm
bobstro
(@bobstro)
Illustrious Member
Wups - Forgot to attach my own file

Here are the gcode and 3MF project file I used to generate the code snippet posted above.

Attachment removed
My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 22/08/2021 2:50 pm
JustMe
(@justme-2)
Active Member
Topic starter answered:
Re

Yes, slicer setting may/will change the gcode file but that is not what I want to do. I want the settings that I have and don't want to change them. The extruder going down before it's time is a bug that should be removed. In the example below it's even more pronounced.

I changed the printer to custom only. Resliced and the beginning of the gcode file is shown.

Look at lines 27 and 30. I commented them out since they are absolutely redundant. Line 32 is exactly where it should be and was put there by the slicer. In the files in my second post above I had to put this line in  this spot myself since the slicer didn't.

I understand that different slicer settings make a different gcode output but I should be able to control it to my needs without having to edit a file every time I generate it. I should be able to get an output file that suits my needs.

 

Respondido : 22/08/2021 5:05 pm
Ringarn67 me gusta
bobstro
(@bobstro)
Illustrious Member
All a guess without being able to look at your settings

Without being able to see what setting you've enabled, this is just a guessing game. Your results look different from mine created using the default Prusa presets. Here's mine with line numbers for comparison:

My line 47 corresponds to your line 24. 

In particular:

  • I don't see anything like your line 27 in your sample in lines 50-54 in my sample. I am wondering whether you're using a Prusa printer, and if not, what preset? If not, perhaps that line is to deal specifically with the bed scraping you were concerned about? My 1st layer height is 0.2mm, so my settings are aware that it is not at the 1st layer height after G80 mesh bed leveling.
  • In any case line 27 is harmless since 30 moves to the correct height.
  • Your lines 28-30 look very similar to my 55-56 which is the retraction being done before z-lift. It does seem your line 29 corresponds to my line 51 which is interesting, but not particularly important.
  • Not sure why you commented out line 30 since that's your z-lift to avoid the bed scraping you were worried about. You appear to have z-lift set to .7mm instead of my 0.4mm. We of course have no way to check these basic settings, so can only guess. You won't share your settings, but it would be interesting to see if you do have z-lift set to 0.7mm.  
  • Line 31 moves (with the nozzle safely lifted above the bed if line 30 is NOT commented out) to the print position.
  • Line 32 lowers it corresponding to my line 60.
  • Line 33 deretracts the retraction done in line 28 corresponding to my line 61.

If I'm understanding you correctly, you are worried about your line 27 that doesn't do much, but is certainly not going to make an impact in the actual print. That line is not present in my samples, so I do have to wonder if you're not using a Prusa printer and perhaps this is a 'safety' feature to avoid having the nozzle at 0 as you were originally concerned about. Your line 30 is a line that raises the nozzle to 0.7mm, likely corresponding to your retraction settings.

All of this is navel-gazing if you won't share your settings. We're playing guessing games as to why the offending line 27 is there in the 1st place. Line 30 should be there specifically to address your bed scraping concerns. Your 2nd snippet specifically does NOT show the same behavior as your 1st snippet and shows a 2mm retraction length.

If you really want to move lines around, you can do that with a post-processing script that will be applied to every gcode file you generate. You are trying to move a line that the defaults don't generate, so other than searching for "G1 Z0.200" (in your 1st sample) or "G1 Z0.200" (in your 2nd sample) it's hard to make more specific suggestions. Without knowing how line 27 got there, it's hard to make a suggest for how to disable or move it.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 22/08/2021 5:56 pm
bobstro
(@bobstro)
Illustrious Member
RE: So much easier if we can see the settings you're using

OK, I changed to a Creality Ender 3 preset and got this result:

I went back to the Prusa Mk3 preset and set z-lift to 0 and got this:

It appears the G1 Z0.200 (or whatever your 1st layer height is) is triggered by z-lift being set to 0. You can eliminate that by specifying some z-lift (which also helps with the bed dragging concern, which tends to be important on layer 1).

Not sure if this addresses your concern, but be aware that any script may need to be aware of your z-lift setting. Or to phrase it differently, that line is generated by the z-lift code and is put there so it's done before the lateral move to the 1st printing point. You could just strip it out with a script if you really don't want it (but I'd want it).

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 22/08/2021 6:12 pm
JustMe
(@justme-2)
Active Member
Topic starter answered:
Re

bobstro, I don't know what settings you want to see. I don't have a Prusa printer, I have a self made clone. I have set my settings to 'custom printer'. If you look at the end of the attached file you'll see my settings. They are added to each file automatically.

But, and it's a big but, the lines I'm referring in my first and in my last post should not be there, period, never mind the settings. That's why I've aske if there is a way to change the output in the slicer module that generates the output gcode. It's a bug in the coding of the slicer.

Respondido : 22/08/2021 7:38 pm
Ringarn67 me gusta
Ringarn67
(@ringarn67)
Reputable Member

@justme-2
I understand perfectly what you are talking about, see it in your g-code and agree with you 100%
It is stupid to move from an higher Z-level, after your XY zeroing or end of primeline, to a lower Z-level Before XY

@bobstro
Try typing in "{if layer_num==0}G1 Z10{endif}" in your after layer change g-code and you'll see what happens in output g-code.

Prusa i3 MK3S+ FW 3.11.0 (kit dec -20), PrusaSlicer 2.6.1+win64, Fusion 360, Windows 10

Respondido : 22/08/2021 8:03 pm
bobstro
(@bobstro)
Illustrious Member
If it's a bug, it's triggered by SETTINGS!
Posted by: @justme-2

bobstro, I don't know what settings you want to see. I don't have a Prusa printer, I have a self made clone. I have set my settings to 'custom printer'. If you look at the end of the attached file you'll see my settings. They are added to each file automatically.

If we can see the settings, we can figure out why those lines are there. They don't seem to be random.

You need to zip your files before attaching them. It's annoying, but a lot of forum software does it this way.

But, and it's a big but, the lines I'm referring in my first and in my last post should not be there, period, never mind the settings.

The lines you've highlighted are put there based on settings.

  • Line 27 in your last example is the usual location for the z-lift line, inserted at every line change. If you have 0 z-lift specified, it moves the nozzle to the 1st layer height, so a 0.2mm Z move there makes sense. I assume this is 0.2mm but can't verify without knowing your settings. 
  • Line 30 in your last example looks like another z-lift line. It does look odd given line 27. Here again, not knowing your settings, there's no way to tell if it "should" be there or not. My settings don't trigger that line, so something is different in our settings. Which brings us back to comparing settings.

If you want see if a feature is available or make a feature request, you do need to specify what setting is causing the problem.

That's why I've aske if there is a way to change the output in the slicer module that generates the output gcode. It's a bug in the coding of the slicer.

If you can't replicate what produces the problem on demand, it's hard to say if it's a bug. Again, without knowing the settings that produced that gcode, we can only speculate. If you go to post an issue on Prusa's GitHub, they are going to ask for this same information as well as a detailed description of the conditions that trigger the problem. The fact that my results aren't the same raise a lot of questions. It's the same software, so if it's a bug, it's triggered by something different between our setups. Settings are the next place to check. Believe me, I'm not interested in any top-secret magical stuff in your configs. I'm trying to help pinpoint the problem!

Unfortunately, in the absence of more information, the most promising option is a post-processing script. There is no "rearrange gcode" feature.

 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 22/08/2021 8:52 pm
bobstro
(@bobstro)
Illustrious Member
RE: Appears to me to be operating exactly as you've told it!
Posted by: @ringarn67

@justme-2
I understand perfectly what you are talking about, see it in your g-code and agree with you 100%
It is stupid to move from an higher Z-level, after your XY zeroing or end of primeline, to a lower Z-level Before XY

It may not be what's expected, but that "lower z-level move" is moving to the z-lift specified in the slicer configuration. If it is set to 0 in the slicer settings, it will go to your 1st layer height. In my mind, it is doing exactly what you told it to. Setting z-lift to 0 indicates "do not lift nozzle above layer height for lateral moves." While you may have moved your Z higher in your startup gcode, the slicer doesn't (apparently) try to decipher what you've done in your startup gcode. If you see the default presets, the nozzle will actually be at 0.15mm Z height after mesh bed leveling, so even that 0.2mm Z move raises it to exactly where you told it to go.

[...] Try typing in "{if layer_num==0}G1 Z10{endif}" in your after layer change g-code and you'll see what happens in output g-code.

That gives me this:

Here's how I read it:

  • Line 54 retracts prior to moving to the next level using the retraction settings you specified.
  • Line 55 lifts the nozzle using the z-lift settings you specified.

These steps are done before lateral moves to avoid collisions and stringing.

  • Lines 56-58 are the lines I explicitly told the slicer to insert in my After Layer Change gcode. The slicer doesn't parse or interpret this code. It's an advanced option, so presumably you know what you're doing.
  • Line 59 moves to the print start point. So far as the slicer knows, the nozzle is still at 0.4mm per line 55.
  • Line 60 lowers the nozzle to your specified layer height (0.2mm in this case). The slicer is unaware that you went out of your way to insert gcode to change the position it was last at (0.15mm after leveling).
  • Line 61 deretracts the filament retracted in line 54.
  • The print continues at line 62.

Again, not being aware of what you've done in the gcode you inserted, the slicer is working with the settings you provided. You can artificially create an odd situation by overriding gcode, but if you want the nozzle higher, there is a setting to do exactly that (z-lift) that you went out of your way to override.

I think what you are describing is a desire for the slicer to interpret that user-inserted gcode, which opens up a bunch of interesting problems (e.g., conditional code) and updating its positioning accordingly. Not having read anywhere that PrusaSlicer does such interpretation, I don't agree that not doing so is a bug.

FWIW - If you wanted to work around this, setting up a "virtual" 2nd extruder with the desired z-lift to use for layer 1, then switching "colors" to a 2nd extruder with the 0 z-lift setting would work, if that's what you are really doing all this for. It just seems a lot easier to me to just set the z-lift setting rather than poke stuff into gcode overrides.

I may be missing something, but if you're describing a bug, it's important to be able to reproduce it on demand.

 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Respondido : 22/08/2021 9:12 pm
Ringarn67
(@ringarn67)
Reputable Member
The lines does not come in the same order

@bobstro

Agree with you, the "code" you provided does exactly what you told it to 👍, and exactly what I wanted to achieve in "after layer change g-code.
Problem is, I get another result with "Z-lift 0.2" 
I can't figure which setting cause this difference?

File is attached

The only reason I can understand this is that Mac version and PC version differ
I have seen it before, in that case it was how PS handles support

Attachment removed

Prusa i3 MK3S+ FW 3.11.0 (kit dec -20), PrusaSlicer 2.6.1+win64, Fusion 360, Windows 10

Respondido : 23/08/2021 3:51 am
Página 1 / 3
Compartir: