Hello Guest it is April 24, 2024, 12:00:59 PM

Author Topic: Macro for measure all Tool in toolrack Issue/Problem.  (Read 1702 times)

0 Members and 1 Guest are viewing this topic.

Macro for measure all Tool in toolrack Issue/Problem.
« on: May 28, 2023, 04:55:09 PM »
Hi to @ll, and first thanks for your help.


I tried to use this macro i found in youtube.

Explanation of the code:
https://www.youtube.com/watch?v=duULYFBjDnk

Showing how it works in real life:
https://www.youtube.com/watch?v=SLq_s0FQ-SA


When i use this macro i have one problem with G53, i think i don't have a mistake in the code (i copied all the code and see if it's correct 2 times coping the video).

The Log say this:
Code: [Select]
Sun - 19:53:46 ---Cannot use g53 incremental , Block = G53 Z-6.5
Sun - 19:53:46 ---Cannot use g53 incremental , Block = G53 Y900
Sun - 19:53:47 ---Cannot use g53 incremental , Block = G53 Z-10
Sun - 19:53:47 ---Cannot use g53 incremental , Block = G53 Z-5
Sun - 19:53:48 ---Cannot use g53 incremental , Block = G53 G00 Z0.0
Sun - 19:53:48 ---Cannot use g53 incremental , Block = G53 G00 X780.61Y1103.32

I don't know if its something relative with the settings in mach3 maybe i go to share my settings.
https://imgur.com/EYpa3HH

Anyone can help me to make it work, if you need more captures of my settings or something for see if my settings are correct tell me and i make it fast.

Thanks for your help.

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #1 on: May 29, 2023, 08:37:56 AM »
i think your machine was in incremental distance mode (G91) and not in absolute distance mode (G90)
when you run the macro.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #2 on: May 29, 2023, 10:25:08 AM »
i think your machine was in incremental distance mode (G91) and not in absolute distance mode (G90)
when you run the macro.

Thanks, i go to investigate more and try to change it i know g90 g91 but i don't understand correctly how it works/affect .

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #3 on: May 29, 2023, 10:29:23 AM »
ok example (in mm):

G90 mode
G1 X100 will move the X-Axis to 100mm in workpice coordinates

G91 mode
G1 X100 will move the X-Axis + 100mm, if it is at 50mm in workpice coordinates it will go to 150mm in workpice coordinates


for a test you can enter G90 in MDI line an run than your macro.


anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #4 on: May 29, 2023, 12:48:55 PM »
i think your machine was in incremental distance mode (G91) and not in absolute distance mode (G90)
when you run the macro.

I tried to see what happens,with g90 (the error i reported in first message it's because the first time after trigger soft limit all mach G's are crazy after restart mach3 3 all worked, not worked but no g53 errors).

When i start the macro with tool 3 inside and say to the prompt what tools i want to measure i say tool 3 and 4 (for make it quick without need a tool change or anything).


The machine go to probe position, i set a random position near me for control better all and trigger the probe by hand (i don't use ISO holder and tools, i don't want to break tools).

When start probing and go down (with low speed, 50mm/min - 25 mm/min) and i trigger the probe the machine go to rapid movement and crash in Z+ (go up and crash).

In the log i see the Getvar 2002 = say 200.31875 and i observed all times i tried this getvar are the same. I think this is incorrect because for what i read getvar 2000-2002 are for read x y z positions.


In my z touch plate macro for set 0 in top of my workpieces (wood) i see the ZProbePos are GetOEMDRO(802)

In my ztouch plate macro have an update in the macro info and say this:

REM (5 August 2021) Custom Version GetVar(2002) replaced With GetOEMDRO(802) As GetVar appears To be unsupported In some hardware.


I go to try to modify this getvar in the code and try to identify all places with this getvar for change it.

I paste my z touch plate working code if anyone need one (one day i need to make a post only with working macros, but first i need to see it's working perfectly).

Code: [Select]

REM Updated 25/01/2022
REM Alternate Auto Tool Zero Z- Metric 2 pass Version
REM Based On the BigTex script
REM (09 Feb 2018)  Hint added To Material Thickness offset request box.
REM (20 Feb 2018)  Request To touch the touch the touchoff plate To the bit To start probing added. Thanks To Glen Higgs For this addition.
REM (27 Jul 2018)  Minor changes To Error Handling And Grammer correction
REM (30 Aug 2018)  Feedrate override safety Reset And restore added.
REM (5 August 2021) Custom Version GetVar(2002) replaced With GetOEMDRO(802) As GetVar appears To be unsupported In some hardware.

PlateThickness = 19.92 'Enter Z-plate thickness here
DownStroke = -25 'Set the down stroke to find probe
DownFeedRate = 100 'Set the down FeedRate
RetractStroke = 5 'Set the retract Stroke
RetractFeedRate = 1000 'Set the retract FeedRate
SmallRetractStroke = 1 'Retract 1mm for a 2nd pass
SmallDownFeedRate = 25 'Set the slow down FeedRate for 2nd pass
SmallDownStroke = -(SmallRetractStroke *2) 'Set down stroke for 2nd pass as twice the retract distance.
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
CurrentFeedOverride = GetOEMDRO(821)'Get current Feedrate override setting

REM Request Material Thickness offset
Offset  = 0

REM  Touch plate To Cutter To Begin probe.
message "Briefly touch the plate to the bit to start probing for zero."
Touched_Flag = False
   count = 40
seconds = 60
    For i = 1 To 600
        If GetOEMLed(825) <> 0 Then               
            Beep
            Touched_Flag = True
            Exit For
        End If
        count = count - 1
        If count = 0 Then ' 1 second elapsed
            count = 40
            seconds = seconds -1
        End If
        Sleep 25
   Next i
If Touched_Flag = False Then
    message "The Auto Zero timed out, no touch detected"
    Exit Sub
End If

REM 1st Pass at fast rate

sleep 2000  'give time to remove block from tool and position
REM Code "(Z axis 1st pass)" 'puts this message in the status bar
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
SetOEMDRO(821,100)  'Reset feedrate overide to 100% for safety
Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetOEMDRO(802) 'get Z axis position
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, 0) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &SmallRetractStroke &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
REM Code "(Z axis 2nd pass)" 'puts this message in the status bar
Else
Rem Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke and try again)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If

REM 2nd pass at slow rate

DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P1" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &SmallDownStroke &" F" &SmallDownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetOEMDRO(802) 'get Z axis position
If Abs(ZprobePos) <= Abs(SmallDownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness - offset) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &RetractStroke + PlateThickness &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection and try again)" 'puts this message in the status bar
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
SetOEMDRO(821,CurrentFeedOverride) 'Return feedrate override to previous value
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub






« Last Edit: May 29, 2023, 12:51:22 PM by cncwoodprojects »
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #5 on: May 29, 2023, 01:02:40 PM »
OMG it's this GetVar2002 have problems with my controller or mach3 version (i don't know) but i changed it and teorically all work good.

I go to test more times in the air and try it with calm when i finish i go to share the code (nots my code its from Bo Andersen).
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #6 on: May 29, 2023, 02:33:06 PM »
I made some changes in the code because toolrack doesnt close (i copied the variables of pin11 and 12 in the start of the program) and all works.

I made 6-7 repetitions with two tools (tool 8 and 9, the closest tools to the tool setter) and i think it's good.

In the logs i see deviation of 0.025mm maximum in various repetitions, for a non industrial CNC it's a good probing or maybe need to try to improve? (i don't know the real precision of the cnc's).
Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #7 on: June 04, 2023, 01:21:06 PM »
Today i have some time and i tried to see how it works the "ATC with tool offsets" i made a zero in a bed table and do a tool change to another one and with my pendant see if the bed table have the same 0 (for see if the tool offset works).

When i tried i see doesn't work (i don't crashed nothing, because i do it manually).

After this i tried to start the tool setter macro another time, after the first tool measuring the tool goes directly to the to of Z+ and the machine stops (alarm of the closed loop steppers).

After the crash to Z+ i closed mach3 and started another time and i referenced all home axes.

And i click to the tool setting macro another time for measure all tools. After this, disaster the spindle go down full and another time alarm.


I see I'm very lost with the G options settings and i think i have a lot of things wrong with my mach3 settings and macro's maybe.

After the last crash my G settings actives are:

G15 G0 G10 G17 G40 G21 G90 G94 G54 G49 G99 G64 G97 (i don't know before this what G's are actives).

I started to read this gcodes and i see i need to activate G40 (this one i think it's obligatory for me, because i don't want tool compensation diameter) and i need to start to use the G43/G49 for the tool offsets (maybe if i used this the first try this doesn't happens but maybe it's good for learn how to solve this problems and have a good config).


If anyone have time to help me to put the correct settings in the mach3 setup, or see if my two macros have issues with G's and this make weird things i'm be really appreciate.

I start to share in this post and next one the screen shots and macros.

Thanks to all for your help i really appreciate your effort.






Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #8 on: June 04, 2023, 01:24:34 PM »
I post here my two macros actually working when i used alone.

(i changed the names because i can't post files with same name).

Re: Macro for measure all Tool in toolrack Issue/Problem.
« Reply #9 on: June 05, 2023, 08:36:05 AM »
Today with more calm (this problems make me nervous  ::))...

I think when i have a crash/problem i have some M.C. incorrect, Tool offsets activated or deactivated (and other ones maybe).

First of all i need to start to watch the Modes in mach3, my screenset have a good info screen for see it and after every problem read the modes (i never have problems and i never started to understand/know all G codes, only the basic ones).

One easy solution (i think), in all my macros in the first lines add all G's "standard" for avoid problems (and maybe put a button in screen-set for set to default all for make it easier).

I go to make a list of the "correct  standard Gcodes for my machine" for use with ATC fully auto and use it sometimes "manually" (i go to try to put a button in my screen set for activate and deactivate the tool length offset's for the days i want make it all manually).


List of G-Codes i think are basics for my normal operation at startup, after something go wrong and maybe the G modes are incorrect:

G01/G90/G97/G54/G21/G15/G40/G17/G80/G49/G94/

G01 for avoid having rapid movements activated.
G90 absolute coordinate, i think i never need G91/91.1/90.1. In normal mode and in macros i can't find any different G9X (better to add it for avoid problems, the macros in theory have all necessary G's for change it if it's necessary).
G97 constant rpm mode (i think this is the S********* for control spindle speed)
G54 it's my normal WC, but the tool setter use another one for tool measurements (better if i add this standard work coords for avoid problems.).
G21 (metric units)
G15 (Carterian coords i think i never use a polar coords.)
G40 Cancel nose radius compensation (with my cnc/atc/toolsetter i only use tool lenght compensation, for safety cancel all other compensations).
G17 XY plane select (i don't know for what reason but in my mach3 mode i have this G17 now and i search info and i see G17 it's the standard i use).
G80 (cancel canned cycles, i never use it, but for safety...)
G49 (cancel all tool offsets compensations, the macros for measure, touch, post processors have G43HXX for activate it and for avoid crashes after bad tool measurement or anything else maybe it's better if i activate it with the macros/gcodes).
G94 Feed per minute mode (i think i never go to use G95/96/97, but safety first...).

Optional ones??:
G64 continuous mode (constant velocity mode)
G50 reset all scale factors to 1.0 (i don't know if this is necessary or its good for safety)
G99 R-Level return after canned cycle (i have this G99 activated in my cnc in this moment i don't know if its normal because i dont undertand what make this Gcode)



Anyone know more "safety" codes for my case or see this lines correct?

All help/comments are appreciated.


Thanks to @ll :)