Welcome! Log In Create A New Profile

Advanced

Dynamic Variables with Settings in G-Code (alteration)

Posted by antimix 
Dynamic Variables with Settings in G-Code (alteration)
May 07, 2013 06:20PM
Yesterday I spent a whole afternoon looking inside Skeinforge.

I was not able to use the "SETTINGS VARIABLES" in G-Code start.gcode through the alteration plugin.
Even trying the samples in the remark source code or some samples on the net they didn't worked.

Basically I wanted to use some values from the profile settings and transfer them to the generated G-CODE.

The idea was to have a custom "start.gcode" with some actions (as example the following):

---------------------------------------------------------
# this is just an example to give the idea

G21; set dimension in mm
G90; use absolute coordinates
M83; use relative mode for extruder
M104 S50;set bed temperature
G28; home
M109 S205; set hot-end temperature
--------------------------------------------------------------

I learn that this code would have been added at the start of the gcode produced by the slicer if the alteration plugin was on.

But I didn't want to have the fixed hard coded M109 S205 and M104 S50 values, but rather the values presents in my current Skeinforge profile.
Looking at the examples on the net, it seems that something like:

---------------------------------------------------------
# this is just an example to give the idea

G21; set dimension in mm
G90; use absolute coordinates
M83; use relative mode for extruder
M104 S&ltsetting.chamber.bedTemperature&gt ;set bed temperature
G28; home
M109 S&ltsetting.temperature.BaseTemperature&gt ; set hot-end temperature
--------------------------------------------------------------

should result in

M104 S50;set bed temperature
M109 S205; set hot-end temperature

on the generated g-code.

HOWEVER IT DIDN'T WORK!

It generated the same line of code:
M104 S&ltsetting.chamber.bedTemperature&gt

it was not translated (stay as it is to be sent to the printer ! ).


Well, after having spent several hours even looking at the sources I figured why.

I realized that IN ORDER TO WORK THE VARIABLE SETTING REPLACEMENT ALTERATION PLUGIN, YOU SHOULD MEET THE FOLLOWING STATEMENT:

- 1) ALTERATION PLUGIN should be ACTIVATED.

- 2) The alteration STARTCODE FILENAME should be the same you are editing; (it may seem stupid, but after having changed the file name in the plugin from "start_PLA.gcode" in "start_test1.gcode" and then in "start_test2.gcode", and playing around, after a while I was editing the wrong file that was not processed).

- 3) THE PLUGIN from which you are trying to get the values SHOULD BE ACTIVATED
So, for example, forget to use the following statement:

M104 S&ltsetting.chamber.BedTemperature&gt

if the "Chamber" plugin is not Activated ! It will result in an unchanged line as M104 S&ltsetting.chamber.bedTemperature&gt in the gcode.

That has the odd effect than you can't use any settings value from a plugin that you don't want to activate.
If I want to use the Temperature value but I don't want the effect the plugin produce on the g-code, then I can't use in my code ANY settings from the temperature plugin, since it is null. Otherwise it will get the setting value, BUT the plugin will do its job (as should be) and this is not always desiderable.

I hope this have clarified the matter of the variable settings in alteration and helped who tried to use this feature without success.

Note that there is no documentation on the settings name to use (at least I did not found it). But looking at the source I understood that it is:
&ltsettings.name of the plugin.Text name of the parameter displayed&gt
Then remove any space and "_.:" characters from the resulting name. Then again remove everything from any "(" to the ")" and the parentheses.

So the parameter in the Chamber plugin with label "Chamber Bed Temperature (Celsius):" become :
"ChamberBedTemperature(Celsius)" and then "ChamberBedTemperature". The name is case insensitive, so you can write as you want.

In the Gcode it should be referenced as &ltsettings.chamber.bedtemperature&gt

That was not exactly intuitive, and required some study to well understand. I hope that someone will find this information useful.

I am thinking to to write a plugin that integrate the Pronterface values with Skeinforge, or BETTER viceversa, since I think Skeinforge should have the priority and set the values in Pronterface.

- Have a pronterface integration plugin in Skeinforge
- This updates the option values of Pronterface based on the current values in the profile.
- Be a Skeinforge plugin, so that who does not use pronterface, can simple not install the plugin, and who use pronterface with Slic3r do not need to change Pronterface.

PS: Who of you was so cute to notice that I used &lttags&gt in this message and you can see them ? Normally they are deleted by the forum engine cool smiley ...
Re: Dynamic Variables with Settings in G-Code (alteration)
May 21, 2013 03:23PM
Thanks for your post, very interesting, since a long time I want to use variables in end.gcode and I'll soon try your suggestions!

Edited 1 time(s). Last edit at 05/21/2013 03:24PM by François Delègue.


François
Sorry, only registered users may post in this forum.

Click here to login