Set Tools Z offsets using switch
-
Hi all,
We have 3 tool printheads in 3 Z independent axis. So we are trying to set each tool Z offset using a switch.
We thought about declaring it as a GPIO pin, and call a trigger.g macro when pressed. This macro will pause the movement, and use the actual Z position to set the offset to the correspondant tool.
Which command should we use to pause the movement the fastest way?
Should we declare it as a z probe instead? (We already declared a z probe in the first Z axis, but we don't know how to combine both).
Thanks in advance.
;pin declaration M950 J1 C"!io1.in" ; declare pin M581 T3 P1 S0 R0 ; call trigger3.g when pressed
;trigger3.g ;pause movement (we don't know which command)
;SET TOOL ZOFFSET G92 ; absolute positioning G0 X0 Y-120 ; go to switch position G1 Z-105 F400; printhead goes down until press the switch G4 S4; wait few seconds until triggers var lastStop = {move.axes[2].machinePosition + 1.3} ;get trigger height + switch travel G10 P{var.toolNumber} Z{- var.lastStop} ;negate value to set it as offset G1 Z105 F800; lift the printhead
-
Any ideas on this?
-
@carlosr you can define more than one z probe.
Maybe look at using G38.2? -
Hi, thanks for the advice.
I have been running some tests. It seems to be working with G38.2 K1 Z-105
It goes down until press the switch, and then lifts.
The problem is that the lastStopHeight on the ObjectModel is always 0, regardless the triggered height.
I need this value because I want to stablish it as a new Z offset for the tool.
-
@carlosr you could move the value into a variable.
so trigger the switch, capture the current position {move.axes[2].machinePosition} (axis 2 for me is z but you'd have to use the appropriate one. and then carry out further calculation using that value -
Hi,
We have managed to make the first part work.
We execute
T{var.tool}; select the tool we want to probe G38.3 Z0 K1; try to reach Z0, stop using probe 1 G10 L20 P{var.tool} Z0; after switch pressed, stablish actual position as selected tool Z0
If the detection is at Z10, for example, now the max position is 100-10 = 90 (which is correct).
So, the Z0 now, corresponds to the previous Z10 (also correct).The problem is that if you move the Z axis down, its not limited to Z0, but Z-10.
I don't now if I am missing something in the Z offset setting process.
-
@carlosr do you know what the difference is between the switch and Z0 measured by your probe?
-
I don't know if I'm getting what are you saying.
I probe the printer using the probe 0, without any tool selected. So the printer Z limits are 0:100.
After that I select a tool, and I execute the commands above to get a value, and set it as a tool Z offset.
This value is relative to the previous 0:100 interval, if I get 10, it means that the tool selected is longer, so I need to stablish its offset as 10. Now the positions interval for the tool should be 0:90. -
@carlosr you're probing a separate switch to determine the tool length, correct?
or are you using the same switch that you probe the bed with to get Z0?using my CNC as an example, I know much touch plate for calibrating tool length is 19.7mm above my z datum, so I can work out the tool offset by using the Z stopped height minus the 19.7mm
I'm just trying to work out where the tool length switch is in relation to Z0