M6 Remap - Something I don't understand - Now I'm stumped.
- JohnnyCNC
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 543
- Thank you received: 100
02 Jun 2022 01:13 #244420
by JohnnyCNC
M6 Remap - Something I don't understand was created by JohnnyCNC
I created a M6 remap that allows me to use a combination of fixed length tool (length in tool table) and variable length tools (Zero length in TT). In the remap code, if the tool length in the tool table is zero the tool goes to the tool sensor and gets measured. I had this working and have used it to make parts. However, the variable length tools are almost always drills and taps and most of the time the holes are through-holes. So, I may have just never noticed the inaccuracy of variable tool measurement until I tried to use it for engraving bits. The error is in the range of .020 to .050. That is the problem I am chasing. I am using QTDragon as my UI. All of my fixed length tools work perfectly. I have a separate GCode file that I use to measure the fixed length tools and populate the tool table value.
I added some (PRINT, ) statements to my m6remap.ngc file and it appears that the code gets executed twice each time it is called. This is what I don't understand. The "Pre M6" line in my main GCode file right before the T22 M6 line. The Post M6 is right after the T22 M6 line. It looks like it is calling the M6 remap code twice. The first time the probe fails (#5070=0.000000) and the second time it succeeds (#5070=1.000000)
Thank You.
John
I added some (PRINT, ) statements to my m6remap.ngc file and it appears that the code gets executed twice each time it is called. This is what I don't understand. The "Pre M6" line in my main GCode file right before the T22 M6 line. The Post M6 is right after the T22 M6 line. It looks like it is calling the M6 remap code twice. The first time the probe fails (#5070=0.000000) and the second time it succeeds (#5070=1.000000)
Loaded tool 0 <- This is from me selecting tool zero so that it sees a new tool (22) is select and performs the measurement.
Pre M6 5063=0.000000
5070=0.000000
5063=2.247716
Post M6 5063=2.247716
Pre M6 5063=2.600264
5070=1.000000
5063=2.563664
Post M6 5063=2.563664
Started program from line 1Loaded tool 0
Pre M6 5063=0.000000
5070=0.000000
5063=2.247716
Post M6 5063=2.247716
Pre M6 5063=2.563664
5070=1.000000
5063=2.530047
Post M6 5063=2.530047
Started program from line 1Loaded tool 0
Pre M6 5063=0.000000
5070=0.000000
5063=2.247716
Post M6 5063=2.247716
Pre M6 5063=2.530047
5070=1.000000
5063=2.496297
Post M6 5063=2.496297
Started program from line 1
John
Please Log in or Create an account to join the conversation.
- JohnnyCNC
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 543
- Thank you received: 100
02 Jun 2022 01:55 #244422
by JohnnyCNC
Replied by JohnnyCNC on topic M6 Remap - Something I don't understand
I think I might be seeing what is going on here. When looking at the full output of the trace file it appears that it may read through the GCode and execute the (PRINT, ) statements only and then when the GCode is actually run the (PRINT, ) statements execute again. I guess I am back to the original problem at hand.
John.
John.
Please Log in or Create an account to join the conversation.
- bevins
- Offline
- Platinum Member
Less
More
- Posts: 1937
- Thank you received: 335
09 Jun 2022 11:02 #244797
by bevins
Replied by bevins on topic M6 Remap - Something I don't understand
When you load the file it will run through the gcode but not process any commands. IT will run the print statements. This is because the interpreter is not in task mode. When you run the file after it is loaded the interpreter will be in task mode and process all commands.I think I might be seeing what is going on here. When looking at the full output of the trace file it appears that it may read through the GCode and execute the (PRINT, ) statements only and then when the GCode is actually run the (PRINT, ) statements execute again. I guess I am back to the original problem at hand.
John.
Please Log in or Create an account to join the conversation.
- JohnnyCNC
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 543
- Thank you received: 100
13 Jun 2022 00:58 #245042
by JohnnyCNC
Replied by JohnnyCNC on topic M6 Remap - Something I don't understand
Thank you. That is what I was observing so I just started ignoring the values on the load pass.
Please Log in or Create an account to join the conversation.
- JohnnyCNC
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 543
- Thank you received: 100
13 Jun 2022 01:09 #245045
by JohnnyCNC
Replied by JohnnyCNC on topic M6 Remap - Something I don't understand - Now I'm stumped.
I am completely stumped as to why the tool measurement in my M6 remap does not get a consistent measurement. The GCode file that I run to measure my fixed-length tools and update the tool table repeats within 10ths so that rules out a flakey tool-setter.
If a tool has a zero length in the tool-table then it gets measure in the remap. That measurement is varying as much as .188.
The tool_offset value is calculated with (-9.558231 + #5063). What is really odd here is that tool_offset oscillates between -6.#### and -12.### inches even though the value in #5063 varies by approximately .188. I'm pretty sure that I have a lot to learn here but I just haven't been able to crack it.
I could swear that this was working in the past but recently I was noticing that my variable length tool were not drilling/engraving to the correct depth. That is what sent me off on this adventure.
These are the values I recorded over 7 test runs:
#5422= -2.802416
#5063= -2.802481
tool_offset= -6.755750
#5422= -2.615850
#5063= -2.615785
tool_offset= -12.174016
#5422= -2.802483
#5063= -2.802547
tool_offset= -6.255684
#5422= -2.615850
#5063= -2.615785
tool_offset= -12.174016
#5422= -2.802766
#5063= -2.802831
tool_offset= -6.753400
#5422= -2.616133
#5063= -2.616068
tool_offset= -12.174299
#5422= -2.802999
#5063= -2.803064
tool_offset= -6.755167
---
This is the code I use to measure my fixed length tools and populate the tool table with the tool length. Repeats within 10ths on an inch.
%
(measure_tool_inch v1.0)
G20
M5 (Turn spindle off)
G43.1 Z0 (Tool length offset reset)
G92.1 (Cancel and reset G92 offsets)
G59.3 (Switch to G59.3 coordinate system)
G91 (Incremental mode)
G38.2 Z-.25 F20 (Measure Gross)
G1 Z.1 F40 (Move Z up .125 inch)
G38.2 Z-.15 F1 (Measure fine)
G10 L11 P#5400 Z0 (Update tool table)
G0 Z1 (Z up one inch)
G54 (switch to G54 coordinate system)
G92.1 (turn off G92 offsets and reset parameters 5211 - 5219 to zero.)
G49
G90 (Switch to absolute mode)
M2
%
--- This is my test code ---
%
(T22 D=0.25 CR=0. - ZMIN=-0.03 - FLAT END MILL)
G90 G94 G17 G91.1 G64 P0.001
G20 (Inch units)
G53 G0 Z0.
G54
T22 M6
G0 X0.2988 Y-0.766
M30
%
--- This is my M6 remap. ---
(m6remap v1.3)
o<m6remap> sub
#2001=0 (Z up distance between probes)
#2002=0 (Fast probe feed rate)
#2003=0 (Slow probe feed rate)
#2004=0 (Z up feed rate.)
o300 if[#<_imperial>]
#2001=.1 (Z up distance between probes)
#2002=25 (Fast probe feed rate)
#2003=1 (Slow probe feed rate)
#2004=40 (Z up feed rate.)
o300 endif
o310 if[#<_metric>]
#2001=2.5 (Z up distance between probes)
#2002=635 (Fast probe feed rate)
#2003=25 (Slow probe feed rate)
#2004=1000 (Z up feed rate.)
o310 endif
#1702=-1 (Safe Z position for tool change)
#1900=#<_coord_system> (Save current coordinate system.)
#<coordinate_system> = #5220
#<workspace_z> = #[5203 + [20* #5220]]
M5 (Turn spindle off)
G80 (Cancel Canned cycles)
o500 if[#<_current_tool> EQ #<_selected_tool>] (Same tool as before so no need to do anything.)
(This is tha same tool)
o500 else
(This is a different tool.)
G90 G0 (Absolute distance mode Rapid move)
M6 T#<_selected_tool>
G43 (Enables tool length compensation.)
o600 if[#5403 NE 0.00000] (Use tool length from tool table)
G10 L2 P#<coordinate_system> Z#[4000 + #<coordinate_system>] (Get touch-off - probe length for current coordinate system)
o600 else (Measure tool to get offset)
G53 X#<_ini[TOOLSENSOR]X_LOC> Y#<_ini[TOOLSENSOR]Y_LOC> (Move to tool setter postion)
G53 Z#<_ini[TOOLSENSOR]Z_PROBE_START> (Move Z to safe height above tool setter to start probe)
G43.1 Z0 (Dynamic Tool Length Offset set to zero.)
G92.1 (Cancel and reset G92 offsets)
G59.3 (select coordinate system 9)
G91 (Incremental Mode)
G38.2 Z#<_ini[TOOLSENSOR]Z_PROBE_DISTANCE> F#2002 (Measure Gross <_ini[TOOLSENSOR]Z_PROBE_DISTANCE>= -5.95)
G1 Z#2001 F#2004 (Z up)
#<probe_distance> = [-2*#2001] ([-2*#2001] = .2)
G38.2 Z#<probe_distance> F#2003 (Measure fine probe_distance = .2)
G4 P0.25 (wait for 0.25 seconds before proceeding)
(PRINT,5422= #5422)
(PRINT,5063= #5063)
#<tool_offset> = [#4001 + #5063]
(PRINT,tool_offset= #<tool_offset>)
G10 L2 P#1 Z#<tool_offset>
G4 P0.25 (wait for 0.25 seconds before proceeding)
G1 Z.1 F40
G90 G0 (Absolute distance mode, Rapid move)
G53 Z#1702 (Z up to safe position)
o600 endif
(Restore orginal coordinate system. G54 to G59.2 only)
o100 if[#1900 EQ 540]
G54
o100 endif
o101 if[#1900 EQ 550]
G55
o101 endif
o102 if[#1900 EQ 560]
G56
o102 endif
o103 if[#1900 EQ 570]
G57
o103 endif
o104 if[#1900 EQ 580]
G58
o104 endif
o105 if[#1900 EQ 590]
G59
o105 endif
o106 if[#1900 EQ 591]
G59.1
o106 endif
o107 if[#1900 EQ 592]
G59.2
o107 endif
o500 endif
G92.1
o<m6remap> endsub
M2
Thank you for reviewing.
John
If a tool has a zero length in the tool-table then it gets measure in the remap. That measurement is varying as much as .188.
The tool_offset value is calculated with (-9.558231 + #5063). What is really odd here is that tool_offset oscillates between -6.#### and -12.### inches even though the value in #5063 varies by approximately .188. I'm pretty sure that I have a lot to learn here but I just haven't been able to crack it.
I could swear that this was working in the past but recently I was noticing that my variable length tool were not drilling/engraving to the correct depth. That is what sent me off on this adventure.
These are the values I recorded over 7 test runs:
#5422= -2.802416
#5063= -2.802481
tool_offset= -6.755750
#5422= -2.615850
#5063= -2.615785
tool_offset= -12.174016
#5422= -2.802483
#5063= -2.802547
tool_offset= -6.255684
#5422= -2.615850
#5063= -2.615785
tool_offset= -12.174016
#5422= -2.802766
#5063= -2.802831
tool_offset= -6.753400
#5422= -2.616133
#5063= -2.616068
tool_offset= -12.174299
#5422= -2.802999
#5063= -2.803064
tool_offset= -6.755167
---
This is the code I use to measure my fixed length tools and populate the tool table with the tool length. Repeats within 10ths on an inch.
%
(measure_tool_inch v1.0)
G20
M5 (Turn spindle off)
G43.1 Z0 (Tool length offset reset)
G92.1 (Cancel and reset G92 offsets)
G59.3 (Switch to G59.3 coordinate system)
G91 (Incremental mode)
G38.2 Z-.25 F20 (Measure Gross)
G1 Z.1 F40 (Move Z up .125 inch)
G38.2 Z-.15 F1 (Measure fine)
G10 L11 P#5400 Z0 (Update tool table)
G0 Z1 (Z up one inch)
G54 (switch to G54 coordinate system)
G92.1 (turn off G92 offsets and reset parameters 5211 - 5219 to zero.)
G49
G90 (Switch to absolute mode)
M2
%
--- This is my test code ---
%
(T22 D=0.25 CR=0. - ZMIN=-0.03 - FLAT END MILL)
G90 G94 G17 G91.1 G64 P0.001
G20 (Inch units)
G53 G0 Z0.
G54
T22 M6
G0 X0.2988 Y-0.766
M30
%
--- This is my M6 remap. ---
(m6remap v1.3)
o<m6remap> sub
#2001=0 (Z up distance between probes)
#2002=0 (Fast probe feed rate)
#2003=0 (Slow probe feed rate)
#2004=0 (Z up feed rate.)
o300 if[#<_imperial>]
#2001=.1 (Z up distance between probes)
#2002=25 (Fast probe feed rate)
#2003=1 (Slow probe feed rate)
#2004=40 (Z up feed rate.)
o300 endif
o310 if[#<_metric>]
#2001=2.5 (Z up distance between probes)
#2002=635 (Fast probe feed rate)
#2003=25 (Slow probe feed rate)
#2004=1000 (Z up feed rate.)
o310 endif
#1702=-1 (Safe Z position for tool change)
#1900=#<_coord_system> (Save current coordinate system.)
#<coordinate_system> = #5220
#<workspace_z> = #[5203 + [20* #5220]]
M5 (Turn spindle off)
G80 (Cancel Canned cycles)
o500 if[#<_current_tool> EQ #<_selected_tool>] (Same tool as before so no need to do anything.)
(This is tha same tool)
o500 else
(This is a different tool.)
G90 G0 (Absolute distance mode Rapid move)
M6 T#<_selected_tool>
G43 (Enables tool length compensation.)
o600 if[#5403 NE 0.00000] (Use tool length from tool table)
G10 L2 P#<coordinate_system> Z#[4000 + #<coordinate_system>] (Get touch-off - probe length for current coordinate system)
o600 else (Measure tool to get offset)
G53 X#<_ini[TOOLSENSOR]X_LOC> Y#<_ini[TOOLSENSOR]Y_LOC> (Move to tool setter postion)
G53 Z#<_ini[TOOLSENSOR]Z_PROBE_START> (Move Z to safe height above tool setter to start probe)
G43.1 Z0 (Dynamic Tool Length Offset set to zero.)
G92.1 (Cancel and reset G92 offsets)
G59.3 (select coordinate system 9)
G91 (Incremental Mode)
G38.2 Z#<_ini[TOOLSENSOR]Z_PROBE_DISTANCE> F#2002 (Measure Gross <_ini[TOOLSENSOR]Z_PROBE_DISTANCE>= -5.95)
G1 Z#2001 F#2004 (Z up)
#<probe_distance> = [-2*#2001] ([-2*#2001] = .2)
G38.2 Z#<probe_distance> F#2003 (Measure fine probe_distance = .2)
G4 P0.25 (wait for 0.25 seconds before proceeding)
(PRINT,5422= #5422)
(PRINT,5063= #5063)
#<tool_offset> = [#4001 + #5063]
(PRINT,tool_offset= #<tool_offset>)
G10 L2 P#1 Z#<tool_offset>
G4 P0.25 (wait for 0.25 seconds before proceeding)
G1 Z.1 F40
G90 G0 (Absolute distance mode, Rapid move)
G53 Z#1702 (Z up to safe position)
o600 endif
(Restore orginal coordinate system. G54 to G59.2 only)
o100 if[#1900 EQ 540]
G54
o100 endif
o101 if[#1900 EQ 550]
G55
o101 endif
o102 if[#1900 EQ 560]
G56
o102 endif
o103 if[#1900 EQ 570]
G57
o103 endif
o104 if[#1900 EQ 580]
G58
o104 endif
o105 if[#1900 EQ 590]
G59
o105 endif
o106 if[#1900 EQ 591]
G59.1
o106 endif
o107 if[#1900 EQ 592]
G59.2
o107 endif
o500 endif
G92.1
o<m6remap> endsub
M2
Thank you for reviewing.
John
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23170
- Thank you received: 4860
15 Jun 2022 11:01 #245181
by andypugh
Replied by andypugh on topic M6 Remap - Something I don't understand - Now I'm stumped.
Rather than G43.1 Z0 (Which I don't think has the effect in the comment) try
G10 L1 Z0
G43
Also, as a time-saver, rather than moving 0.25" off the sensor, do a fast probe-up to loss of contact, and then a slow probe back down.
G10 L1 Z0
G43
Also, as a time-saver, rather than moving 0.25" off the sensor, do a fast probe-up to loss of contact, and then a slow probe back down.
Please Log in or Create an account to join the conversation.
Time to create page: 0.066 seconds