save tooloffsets on SD
-
I wrote a macro that takes the offset position from the current position (over a permanently installed camera) using G10.
;_Cam_XYset.g ;setze Offset X, Y für das aktive Tool var curX = 310 - move.axes[0].machinePosition var curY = -3 - move.axes[1].machinePosition if !(state.currentTool == -1) G10 P{state.currentTool} X{var.curX} Y{var.curY}
it works fine.
now I would like to automatically write the values to a file (e.g.:XYZ_offsete.g). But my attempt does not resolve the variables.
;save_offsets.g M28 "0:/sys/xyz_offset.g" G10 P0 X{tools[0].offsets[0]} Y{tools[0].offsets[1]} Z{tools[0].offsets[2]} ; T0 G10 P1 X{tools[1].offsets[0]} Y{tools[1].offsets[1]} Z{tools[1].offsets[2]} ; T1 G10 P2 X{tools[2].offsets[0]} Y{tools[2].offsets[1]} Z{tools[2].offsets[2]} ; T2 G10 P3 X{tools[3].offsets[0]} Y{tools[3].offsets[1]} Z{tools[3].offsets[2]} ; T3 M29 "0:/sys/xyz_offset.g"
returns
;xyz_offset.g" G10 P0 X{tools[0].offsets[0]} Y{tools[0].offsets[1]} Z{tools[0].offsets[2]} G10 P1 X{tools[1].offsets[0]} Y{tools[1].offsets[1]} Z{tools[1].offsets[2]} G10 P2 X{tools[2].offsets[0]} Y{tools[2].offsets[1]} Z{tools[2].offsets[2]} G10 P3 X{tools[3].offsets[0]} Y{tools[3].offsets[1]} Z{tools[3].offsets[2]}
but it should return like that
G10 P0 X19.85 Y43.7 Z-7.68 G10 P1 X20.45 Y44 Z-6.71 G10 P2 X20.15 Y44 Z-7.46 G10 P3 X21.25 Y43.7 Z-6.99
-
@johonline Starting with RRF 3.4.0, you can use the echo command to achieve your goal. Try this (untested):
var fName = "xyz_offset.g" echo >{var.fName} "; Stored Offsets" echo >>{var.fName} "G10 P0 X"^X{tools[0].offsets[0]}^" Y"^Y{tools[0].offsets[1]}^" Z"^Z{tools[0].offsets[2]} ...
With a single ">", echo creates a new file or overwrites an existing one. With ">>", echo appends a line to the file.
-
-
Doesn't M500 P10 achieve what you need?
Then put M501 at the end of your config.g -
Thanks
I can use both solutions in my project. -
@johonline
My solution to measure the nozzle tip on the tool changer with a 2nd micro switch on the edge of the print bed (in series in the micro switch on the tool carrier). --> I no longer need to adjust the microsteps! (the nozzle and the bed should be hot!)T-1 M98 P"homez.g" ; Home Z G90 G1 Z10 G1 X309.5 Y205 Z10 F50000 G30 S-1 var null_Z = move.axes[2].machinePosition 0.03; 0.1 eng -0.6 weit G1 Y190 Z10 T0 G90 G1 Z10 G1 X309.5 Y200 Z10 F50000 G1 X309.5 Y205 Z10 F50000 G30 S-1 var tool_Z0 = var.null_Z - move.axes[2].machinePosition G10 P0 Z{var.tool_Z0} G1 Y190 Z10 T1 G90 G1 Z10 G1 X309.5 Y200 Z10 F50000 G1 X309.5 Y205 Z10 F50000 G30 S-1 var tool_Z1 = var.null_Z - move.axes[2].machinePosition G10 P1 Z{var.tool_Z1} G1 Y190 Z10 T2 G90 G1 Z10 G1 X309.5 Y200 Z10 F50000 G1 X309.5 Y205 Z10 F50000 G30 S-1 var tool_Z2 = var.null_Z - move.axes[2].machinePosition G10 P2 Z{var.tool_Z2} G1 Y190 Z10 T3 G90 G1 Z10 G1 X309.5 Y200 Z10 F50000 G1 X309.5 Y205 Z10 F50000 G30 S-1 var tool_Z3 = var.null_Z - move.axes[2].machinePosition G10 P3 Z{var.tool_Z3} G1 Y190 Z10 T-1 M500 P10