Looking at it I found the saved position #<_Z> is never used. Of course it did 
not work as expected at first try so had
to rewrite a few times and probably at some point added it to the code and 
forgot about it. Use realtive position G91.

Nicklas Karlsson


fre 2025-03-14 klockan 20:22 -0700 skrev John Dammeyer:
> Ni Nicklas,
> When I saw your
>  
> #<Z>=#<_Z>               ; save start Z position
> 
> I thought I'd just mention the expensive issue that statement cost me a few 
> years ago.
> 
> https://forum.linuxcnc.org/49-basic-configuration/29187-work-with-probe?start=620#275243
> 
> Follow the above thread backwards to see the remains of the probe and how I 
> prevented this from happening again.
> 
> I've finally restarted working with the probe now a few years later.  The 
> tool setter is even actually anchored down
> onto the mill table.  
> But for some strange reason every tool probed comes out with the incorrect 
> length and the workspace Z==0 position is
> incorrect.  Off by as much as the entire tool length.  I've screwed up 
> somewhere.  Not sure where.
> John
> 
> 
> > -----Original Message-----
> > From: Nicklas SB Karlsson [mailto:n...@nksb.eu]
> > Sent: March 14, 2025 3:21 PM
> > To: emc-users@lists.sourceforge.net
> > Subject: Re: [Emc-users] Accessing HAL variables.
> > 
> > Have the following rows in a .ngc file run then pressing a button:
> > 
> > o<touch-off-tool> sub
> > 
> > ;#1 = 60 ; [ps_searchvel] search speed
> > ;#2 = 10 ; [probe.ps_probe_max] search distance
> > #3 = 6.5 ; [ps_probe_latch] probe distance
> > #4 = 60 ; [probe.ps_probevel] probe velocity
> > #5 = 120 ; [TOOLSENSOR]RAPID_SPEED] rapid speed
> > #6 = 5   ; Clear distance after probe
> > 
> > (preamble)
> > M70                     ; Save Modal State
> > G17 G21 G40 G49 G59.3 G80 G90 G94 ; Cancel tool length compensation is
> > important
> > 
> > M64 P5                  ; Select tool setter
> > M64 P6                  ; Turn on => select edge detector or tool setter
> > 
> > G10L2P0 Z0              ; Zero coordinate system
> > #<Z>=#<_Z>               ; save start Z position
> > G21                     ; G20 use inch, G21 use mm for length units
> > G91                     ; Incremental distance mode
> > F #4                    ; Feed rate probe velocity
> > G38.3 Z[-#3]             ; Probe towards work piece stop on contact G38.2 
> > signal
> > error, G38.3 no error signal
> > O113 if [#5070 EQ 0]    ; Timeout?
> >   G90                     ; Absolute distance mode
> >   M65 P6                  ; Turn off => set probe input to false
> >   M72                     ; Restore modal state
> >   M66 P4 L3 Q.1           ; Must wait otherwise not turned off, wait for not
> > supposed to happen tool-released = false
> > L3=>wait for high, must be here?
> >   (abort, Probe failed to make contact)    ; Show error message
> > O113 endif
> > 
> > M65 P6                  ; Turn off => set probe input to false
> > (print, probe Z=#5063)
> > G90                     ; Absolute distance mode
> > G10 L1 P#5400 Z#5063    ; G10 L2 set tool table, P tool number, Z length
> > negative to measure opposite direction, #5400 =
> > #<_current_tool>
> > G90                     ; Absolute distance mode, needed otherwise jog have
> > problem!!! incremental
> > ; Running in MDI mode and jog work afterwards but only sometimes if
> > pressing the button from manual mode?
> > G1 Z#<Z> F#5            ; Move back to start start point with rapid speed
> > 
> > M72                     ; Restore modal state
> > o<touch-off-tool> endsub
> > M2
> > 
> > Use the same file to measure probe length. P5 and P6 is to select if input
> > should come from edge detector or tool
> > setter. Parameter #3 probe distance I have set to a distance slightly 
> > shorter
> > than spring length on tool setter in case
> > it fail to detect contact.
> > 
> > Tried to drill and thread a hole to connect tool setter top plate to digital
> > input. Hardened steel so the drill did not
> > even scratch it. Ended using a hose clamp.
> > 
> > Nicklas Karlsson
> > 
> > 
> > tor 2025-03-13 klockan 10:52 -0700 skrev John Dammeyer:
> > > I'm back to trying to get my head around tool probing and tool length
> > > sensing.�
> > > Say I have this in the psng_manual_change.ngc file.
> > > �
> > > #<touch_result> = #5063
> > > #<setterheight> = #<_ini[TOOLSENSOR]SETTER_HEIGHT>
> > > #<workheight> = #<_ini[PROBE_SCREEN]WORK_HEIGHT>
> > > #<blockheight> = #<_hal[probe.blockheight]>
> > > �
> > > ; Put new tool length into tool table.
> > > G10 L1 P#<tool> Z[#<workheight> - #<setterheight> + #<touch_result>]
> > > �
> > > From the MDI command line or from one of the AXIS menu items can I
> > examine
> > > these values?
> > > I� do know that for example that:
> > > #<_ini[TOOLSENSOR]SETTER_HEIGHT>
> > > �
> > > �
> > > Is loaded from the ini file
> > > [TOOLSENSOR]
> > > # Absolute distance of top of tool sensor when light comes on.� Amount
> > table
> > > moves up.
> > > SETTER_HEIGHT = 3.673
> > > �
> > > But after the statement
> > > �
> > > #<setterheight> = #<_ini[TOOLSENSOR]SETTER_HEIGHT>
> > > �
> > > Is there an interactive way of examining #<setterheight>� or any of the
> > > other parameters?
> > > �
> > > I can add debugging statements to the .ngc G-Code file but I was
> > wondering
> > > about something interactive or table based?
> > > �
> > > (debug, Tool Length = #<workheight> - #<setterheight> + #<touch_result>)
> > > �
> > > 
> > > _______________________________________________
> > > Emc-users mailing list
> > > Emc-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/emc-users
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
> 
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users




_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to