Notifications
Clear all

gCode for parameters  

  RSS
raphael.c4
(@raphael-c4)
New Member
gCode for parameters

I am trying to set some of the parameters in the before_layer custom code such as bridge print speed, bridge fan speed, retraction speed..etc..

I can set some of the normal gCode for M140, M190, M106, etc..

not not all the parameters seem to have gCode numbers.

Can someone show how to set some of the parameters?

my goal is to use the temp towers to modify the settings to dial in things like retraction speed and bridge fan speed( I can set overall fan speed but not the 'bridge_fan_speed'..

please help!

Posted : 18/08/2018 5:37 pm
RetireeJay
(@retireejay)
Reputable Member
Re: gCode for parameters

All of the settings you mention are available in Slic3r PE. You set them in the user interface screens of the program, not in the "G-Code" windows.

Posted : 18/08/2018 7:43 pm
bobstro
(@bobstro)
Illustrious Member
Re: gCode for parameters


[...] not not all the parameters seem to have gCode numbers.

I think I understand what you're trying to do, and you are right that not everything has corresponding gcode parameters. You didn't mention what slicer you're using, but assuming you're using Slic3rPE, you do have access to the internal parameters. If you hover your mouse over a setting, you should see a "parameter name" noted at the bottom of the pop-up tooltip help. That corresponds to the parameter used internally by Slic3rPE. You can view these in the gcode file as well. Slic3rPE puts them all at the bottom of the generated gcode file as comments preceded with a semicolon.

While that's great, it does have some limitations. Most of the settings are only used by Slic3r when it generates the gcode. They figure into the calculations used. That means that changing them after gcode has been generated won't do anything for you. What does work is using the layer, temp and other placeholder values along with some of the basic match capabilities provided by Slic3r.

As you noted, you can use the Before layer change G-code to insert custom gcode snippets. I've not done this for a while, but you should be able to use Slic3r placeholders (see http://mauk.cc/mediawiki/index.php/Slic3r_placeholders ) along with some math to do what you want. I think layer_num is what you're after. You can see an exapmle in the End G-code that you can use as an example:

{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+60, max_print_height)}{endif}

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

Posted : 18/08/2018 9:46 pm
raphael.c4
(@raphael-c4)
New Member
Topic starter answered:
Re: gCode for parameters

This is VERY helpful. thank you. I will make some trials and see what I can learn.

Posted : 19/08/2018 5:30 am
raphael.c4
(@raphael-c4)
New Member
Topic starter answered:
Re: gCode for parameters

Hi, Thanks for the link. In the placeholders they reference accessing a parameter, not setting the parameter.

What I want to do is before a certain layer, such as a temp tower, I want to change the bridge speed.

something like
{if layer_z==1.6}
M104 S245
bridge_fan_speed 50
{endif}

And the gcode pick it up and set that bridge fan speed for that layer.. until I change it for a different layer.

the question is will that work.. for thing like M104 it is awesome.. but what about parameters?

Ray

Posted : 19/08/2018 8:33 pm
bobstro
(@bobstro)
Illustrious Member
Re: gCode for parameters

So far as I understand it, you cannot change print parameters. What you're essentially doing is a glorified find-and-replace for gcode. You can modify and insert gcode that will be inserted into the file for printing, but you cannot alter the parameters that were used to generate the actual printable gcode. In the specific case of fan speeds, you might be able to kludge together some gcode to insert M-codes to adjust fan speeds at various points in the print. In other cases such as filament diameter, there may be nothing you can do. Bridge fan speed is going to be tough because you'd have to be able to isolate those lines of gcode that are used to print the bridge features. Short of tedious manual inspection, I'm not sure there's an easy way to do that.

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

Posted : 19/08/2018 11:32 pm
Share: