I think I'm at my wits end here. I am trying to add a touch probe for setting the z-height automatically, but I cannot seem to figure it out. I honestly didn't think this would be such the ordeal, but here we are.
So far, I've connected the touch plate to one of the inputs on my 7i96 and verified that it is triggering correctly when the circuit is connect by monitoring through the HAL meter. That was the easy part.
What I'd like to do now is have a button or a command on the UI in AXIS where I can run a simple routine to lower the z-axis to hit the plate, back off, and then approach it again before storing the coordinate. I found the following code (pulled from
here
):
Code:
o<touch_plate_z> sub
#<PlateThickness> = .2505 ( Thickness of your touch plate when proving in the Z orientation, this is used to re-calculate your new zero after touching off )
#<FastProbe> = 10 ( This is the probe speed used for your initial search, this should be a slow value to avoid damaging your tool, but doesn't not need to "crawl" )
#<SlowProbe> = 5 ( This is the probe speed for the final search, this should be a very slow value to improve the accuracy of the probing )
#<ZProbeRange> = -.50 ( This is the distance the probe will travel on its initial search before erroring out, should be a negative value )
#<ProbeLift> = 0.10 ( This is the distance the probe will lift off the touch plate prior to starting the second search )
#<ProbeRetract> = 1.00 ( This is the distance the probe will lift from the touch plate after successfulprobing to allow for removal of the plate )
#<tempParam> = #1
( Set current Z position to 0 so that we will always be moving down )
G10 L20 P0 Z0
( Probe quickly for initial contact )
G91
F[#<FastProbe>]
G38.2 Z[#<ZProbeRange>]
( Move off plate for slow search )
F[#<SlowProbe>]
G1 Z[#<Probelift>]
( Pause for 0.5 Sec )
G4 P0.5
( Slow probe search )
g38.2 Z[-2 * #<ProbeLift>]
( Move up to set new zero )
G1 Z[#<ProbeRetract>] F[#<FastProbe>]
( Set Z0 at point where probe triggers with offset of plate thickness)
G10 L20 P0 Z[#<ProbeRetract> + #<PlateThickness>]
o<touch_plate_z> endsub
M2
Thanks to the author for putting in copious amounts of comments so I can follow and confirm it will roughly do what I'm looking for.
I also followed the instructions on that page and have triple checked that I have things set correctly, but I'm beginning to suspect I missed some key information elsewhere that is part of the printnc setup, which I don't have in place for my setup.
I read through all of the posts I can find on the forums here and I cannot seem to find one that matches my situation. One thing I suspect is that this cannot be done by just using AXIS and I would need another user interface to get this setup.
I have been able to add a button, but I could not find any documentation on how to tie that button to an action.
I have been able to add a new tab/panel that runs the subroutine, but from what I can tell, that subroutine replaces the existing gcode that is loaded and that isn't ideal for tool changes mid-program.
So, what I'm hoping to find an answer to:
- Can this be done in AXIS?
- Am I taking the correct approach, as in the one from the printnc instructions?
- Do I need to learn Python to accomplish this
- And I guess, how come there isn't a simple setup for this already? I know there are a lot of variations to how this could be implemented but just seems like at least one route could exist for those of use who cannot code for LinuxCNC. /shrug
Thanks in advance!