Javascript / Expressions
Allows Gcode to execute javascript. Please note the German version is the original!
General
[ ] are expressions that are evaluated. The scripting language used is Javascript. So you can do almost everything that is possible in Javascript, but is limited to one line. Functions that have to span several lines are compressed by minifier ” become.Save variable: [var start_x = 5;] Use of variable: G0 X[start_x]
Calculate:G0 X[50+22.5] Y[50/10]Calculate:G0 X[Math.sin(90 * Math.PI / 180)]
Functions
Functions must always be in one line. The easiest way to achieve this is a minifier .
becomes
If you now want to execute these lines, type :
[function runHello(o){dialog.addInfo(“Hello World “+o),dialog.show()}]
[runHello(255)]
into the Gcode input
A dialog with “Hello World 255” should appear.
Dialogue
The dialog extension allows the user to display information as well as create input fields.
- dialog.addInfo(info)
String : info
- dialog.addInput(variable,inputname)
- dialog.addInput(variable,inputname,default)
- dialog.show( )
String : variable
String : inputname
variable specifies the name in which the input value is stored. Bspdialog.addInput(“x”,”max X: “). Shows “max X:” as an input field and saves the value using var x = value.
String : variable
String : inputname
String : default
As above, only a default value is displayed.
Shows the dialog. When closing, possible variables are set and info/input fields are deleted.
Save
The save extension allows the user to save custom variables permanently. These are loaded when the software is started.
- data.save(variable,value)
String : variable
String: value
Example: var x = 55;and with data.save(“test”,x) the value 55 for test is saved in the permanent file. The variable test is not created directly, var test = 55 is only executed with data.load().
- data.load()
- machine.x
- machine.y
- machine.z
- last_probe_.x
- last_probe_.y
- last_probe_.z
- last_probe_.valid
- toolchange.x
- toolchange.y
- toolchange.z
- toolchange.enable
Loads all variables stored in the permanent file.
Variables
Variables that correspond to the settings of the milling machine. Changing these variables does not change anything in the real settings.
Machine width(x)/ length(y) / height(z) positive values
X/Y/Z position of last probe operation, valid indicates if probe is valid.
Tool change position stored in settings/gcode. enable indicates whether the tool change is activated.
Examples:
length sensor / probe
Performs a probe towards minimum Z height. The variable machine.z is used for this. The sample position is displayed in a dialog.
Timekeeping
Measures the time how long a Gcode took and gives a dialog at the end showing the total time taken as from the current file. The code must be inserted in the settings/Gcode pre and post Gcode
Dialog / Customizable Gcode
In this example, the user is prompted for the width and height of a rectangle. This is followed after clicking Next.
More ideas
Detect if the tool has been damaged : When the cutter is measured, store the Z value and measure again after use and compare the value. If the value deviates too much, move to a safe position, stop the spindle and pause with M0. This could be inserted directly into the ToolGcode for an automatic tool change spindle.
Time measurements: how long was the cutter used /how long did the milling process take
Save your todo list for next time.
Tap: Set to zero probe is run in Z X Y.
If further variables or options are desired, mail to office@minimill.at