Hello,
I have done a little bit of reading into the meta commands, and done some reading on the forums in regards to the counters. A little while ago there seemed to be talks of how to implement 'distance travelled' for maintenance purposes.
I have written a little workaround below, but would love to know if this is something that may be implemented in the future. The code below could be considered something akin to an .h file, that can be called just prior to a G1 or G0 command.
;begin
var x_dist = abs(move.axes[0].userPosition - move.axes[0].machinePosition)
var y_dist = abs(move.axes[1].userPosition - move.axes[1].machinePosition)
var z_dist = abs(move.axes[2].userPosition - move.axes[2].machinePosition)
var distance = {var.x_dist,var.y_dist,var.z_dist}
var odometer = fileread("odometer.csv",1,9,',')
while iterations < 3
var i = iterations + 6
set var.odometer[i] = var.odometer[i] + var.distance[i]
if var.odometer[i]>999
var.odometer[i-3] = var.odometer[i-3] + floor(var.odometer[i-0]/1000)
var.odometer[i-0] = var.odometer[i-0] + mod(var.odometer[i-0],1000)
if var.odometer[i-3]>999
var.odometer[i-6] = var.odometer[i-6] + floor(var.odometer[i-3]/1000)
var.odometer[i-3] = var.odometer[i-3] + mod(var.odometer[i-3],1000)
echo >"odometer.csv" "km:m:mm"
while iterations < 9
echo >>>odometer.csv var.odometer[iterations]
;end
If anyone would like me to go over how this works, please let me know and I can post later, however my main concern (where I'm stuck and unsure how to continue) is how to implement this into a machine flow. Since I am using FFF, I have considered saving this as G1.g , and calling G0 at the end of it, but this falls down if one or more parameters haven't been called.
Ideally, I'm looking for an implementation of distance travelled, or maybe move.axes[].distance, or something similar.
If anyone has any ideas where I could utilise this then that would be much appreciated.
~Q