# Manual tool change + tool lengh touch off

*hancock*on topic

*Manual tool change + tool lengh touch off*

orangecat wrote:

hancock wrote: I looked into my gcode and i found that after every tool change

N60 G43 Z15. H1

That's the problem. G43 H1 will reset the tool offset that the touch-off set, to be the tool offset stored in the tool table for tool 1.

By removing G43 H1, all should work well. I don't know if you want to move to Z15 at this point. Maybe not, in which case the entire line can be removed.

Thanks for all the help! It seems that it was indeed the problem. I removed the H and Z values before but the G43 was constantly resetting the offset. Took some time to figure out how to remove the code from the post-processor but know I can work again

And if anyone has the same problem, this is the line I removed from the "linuxcnc.cps"-post-processor:

`writeBlock(gMotionModal.format(0), gFormat.format(43), zOutput.format(initialPosition.z), hFormat.format(lengthOffset));`

Thanks again & great community!

Please Log in or Create an account to join the conversation.

*orangecat*on topic

*Manual tool change + tool lengh touch off*

For reference, because it's lost in the middle of this thread, the link to the manual tool change code can be found here:

forum.linuxcnc.org/forum/10-advanced-con...h-off?start=30#48235

Please Log in or Create an account to join the conversation.

*hancock*on topic

*Manual tool change + tool lengh touch off*

It's me again and I stumbled upon another problem with the routine.

When I use a 1mm bit again during a file, I get the error that the

**"Move in line 120 would hit the positive limit of Joint 2"**.

The line 120 in the file "too-change.ngc" is:

G53 G1 F[#<_TravelFeed>] Z[#5183 - #<_ToolZLast> + #<_ToolZ>] ( return to where we were in Z, ajusting for tool length change )

As far as I understand it, the problem is that the newly adjusted hight of the Z-axis is somehow colliding with my limits but I have now idea why because when I run the program again, the Z-hight is correctly adjusted and I get no error.

I don't want to mess around in that part of the code but it would be great if I could get it to work properly because right now I have to remove all line pre the current step from my Gcode. The offset is still correct.

Thanks for any suggestions!

Cheers,

Hancock

Please Log in or Create an account to join the conversation.

*orangecat*on topic

*Manual tool change + tool lengh touch off*

N60 G43 Z15. H1

really should have been replaced with:

N60 Z15.

that would (typically) move the tool above the work before a tool change so that a shorter tool wouldn't give a limit error when moving back.

Please Log in or Create an account to join the conversation.

*hancock*on topic

*Manual tool change + tool lengh touch off*

orangecat wrote: that code from earlier:

N60 G43 Z15. H1

really should have been replaced with:N60 Z15.

that would (typically) move the tool above the work before a tool change so that a shorter tool wouldn't give a limit error when moving back.

I replaced the code in my post-processor so I don't have the "G43" and "H1" in my gcode anymore. But it still happens...

For example this is my code

```
%
(CAGE)
(T17 D=1. CR=0. - ZMIN=-0.5 - SCHAFTFRSER)
(T21 D=0.5 CR=0. - ZMIN=-0.2 - SCHAFTFRSER)
N10 G90 G94 G17 G91.1
N15 G21
N20 G53 G0 Z0.
(0.5 SENKFRSEN)
N25 M9
N30 T21 M6
N35 T17
N40 S42000 M3
N45 G54
N50 M9
N60 G0 X-6.495 Y-5.65
N65 G0 Z15.
N70 Z1.95
N75 G1 Z0. F250.
N80 X-6.47
N85 G3 X-6.445 Y-5.625 I0. J0.025
N90 X-6.545 Z-0.05 I-0.05 J0. F20.
N95 X-6.445 Z-0.1 I0.05 J0.
N100 X-6.545 Z-0.15 I-0.05 J0.
N105 X-6.445 Z-0.2 I0.05 J0.
N110 X-6.545 I-0.05 J0.
N115 X-6.445 I0.05 J0.
N120 X-6.47 Y-5.6 I-0.025 J0. F250.
N125 G1 X-6.495
N130 G0 Z5.
N135 X-0.022 Y5.638
N140 Z1.95
N145 G1 Z0. F250.
N150 X-0.034 Y5.616
N155 G3 X-0.025 Y5.582 I0.022 J-0.013
N160 X0.025 Y5.668 Z-0.05 I0.025 J0.043 F20.
N165 X-0.025 Y5.582 Z-0.1 I-0.025 J-0.043
N170 X0.025 Y5.668 Z-0.15 I0.025 J0.043
N175 X-0.025 Y5.582 Z-0.2 I-0.025 J-0.043
N180 X0.025 Y5.668 I0.025 J0.043
N185 X-0.025 Y5.582 I-0.025 J-0.043
N190 X0.009 Y5.591 I0.013 J0.022 F250.
N195 G1 X0.022 Y5.612
N200 G0 Z5.
N205 X6.517 Y-5.613
N210 Z1.95
N215 G1 Z0. F250.
N220 X6.504 Y-5.591
N225 G3 X6.47 Y-5.582 I-0.022 J-0.012
N230 X6.52 Y-5.668 Z-0.05 I0.025 J-0.043 F20.
N235 X6.47 Y-5.582 Z-0.1 I-0.025 J0.043
N240 X6.52 Y-5.668 Z-0.15 I0.025 J-0.043
N245 X6.47 Y-5.582 Z-0.2 I-0.025 J0.043
N250 X6.52 Y-5.668 I0.025 J-0.043
N255 X6.47 Y-5.582 I-0.025 J0.043
N260 X6.461 Y-5.616 I0.012 J-0.022 F250.
N265 G1 X6.474 Y-5.637
N270 G0 Z15.
N280 M5
N285 G53 Z0.
(1.0 KONTUR 1)
N290 M9
N295 M1
N300 T17 M6
N305 T21
N310 S42000 M3
N315 M9
N325 G0 X6.239 Y-6.903
N330 G0 Z15.
N335 Z5.
N340 G1 Z-0.05 F50.
N345 X6.241 Y-6.896 Z-0.088
N350 X6.247 Y-6.875 Z-0.121
N355 X6.256 Y-6.844 Z-0.142
N360 X6.266 Y-6.807 Z-0.15
N365 X6.293 Y-6.711 F400.
N370 G3 X6.224 Y-6.588 I-0.096 J0.027
N375 G2 X5.547 Y-5.944 I0.271 J0.963 F70.
N380 G1 X1.753 Y-3.753
N385 G3 X1.637 Y-3.764 I-0.05 J-0.087
N390 G2 X-1.637 I-1.637 J1.889
N395 G3 X-1.753 Y-3.753 I-0.066 J-0.076
N400 G1 X-5.547 Y-5.944
N405 G2 X-7.443 Y-5.306 I-0.948 J0.319
N410 X-6.297 Y-4.645 I0.948 J-0.319
N415 G1 X-2.503 Y-2.454
N420 G3 X-2.455 Y-2.349 I-0.05 J0.087
N425 G2 X-0.817 Y0.488 I2.455 J0.474
N430 G3 X-0.75 Y0.582 I-0.033 J0.095
N435 G1 Y4.964
N440 G2 X0.75 Y6.286 I0.75 J0.661
N445 Y4.964 I-0.75 J-0.661
N450 G1 Y0.582
N455 G3 X0.817 Y0.488 I0.1 J0.
N460 G2 X2.455 Y-2.349 I-0.817 J-2.363
N465 G3 X2.503 Y-2.454 I0.098 J-0.019
N470 G1 X6.297 Y-4.645
N475 G2 X6.693 Y-6.605 I0.198 J-0.98
N480 X6.224 Y-6.588 I-0.198 J0.98
N485 G3 X6.101 Y-6.657 I-0.027 J-0.096 F400.
N490 G1 X6.073 Y-6.753
N495 X6.063 Y-6.79 Z-0.142
N500 X6.054 Y-6.821 Z-0.121
N505 X6.048 Y-6.842 Z-0.088
N510 X6.046 Y-6.849 Z-0.05
N515 X6.239 Y-6.903
N520 Z-0.2 F50.
N525 X6.241 Y-6.896 Z-0.238
N530 X6.247 Y-6.875 Z-0.271
N535 X6.256 Y-6.844 Z-0.292
N540 X6.266 Y-6.807 Z-0.3
N545 X6.293 Y-6.711 F400.
N550 G3 X6.224 Y-6.588 I-0.096 J0.027
N555 G2 X5.547 Y-5.944 I0.271 J0.963 F70.
N560 G1 X1.753 Y-3.753
N565 G3 X1.637 Y-3.764 I-0.05 J-0.087
N570 G2 X-1.637 I-1.637 J1.889
N575 G3 X-1.753 Y-3.753 I-0.066 J-0.076
N580 G1 X-5.547 Y-5.944
N585 G2 X-7.443 Y-5.306 I-0.948 J0.319
N590 X-6.297 Y-4.645 I0.948 J-0.319
N595 G1 X-2.503 Y-2.454
N600 G3 X-2.455 Y-2.349 I-0.05 J0.087
N605 G2 X-0.817 Y0.488 I2.455 J0.474
N610 G3 X-0.75 Y0.582 I-0.033 J0.095
N615 G1 Y4.964
N620 G2 X0.75 Y6.286 I0.75 J0.661
N625 Y4.964 I-0.75 J-0.661
N630 G1 Y0.582
N635 G3 X0.817 Y0.488 I0.1 J0.
N640 G2 X2.455 Y-2.349 I-0.817 J-2.363
N645 G3 X2.503 Y-2.454 I0.098 J-0.019
N650 G1 X6.297 Y-4.645
N655 G2 X6.693 Y-6.605 I0.198 J-0.98
N660 X6.224 Y-6.588 I-0.198 J0.98
N665 G3 X6.101 Y-6.657 I-0.027 J-0.096 F400.
N670 G1 X6.073 Y-6.753
N675 X6.063 Y-6.79 Z-0.292
N680 X6.054 Y-6.821 Z-0.271
N685 X6.048 Y-6.842 Z-0.238
N690 X6.046 Y-6.849 Z-0.2
N695 X6.239 Y-6.903
N700 Z-0.35 F50.
N705 X6.241 Y-6.896 Z-0.388
N710 X6.247 Y-6.875 Z-0.421
N715 X6.256 Y-6.844 Z-0.442
N720 X6.266 Y-6.807 Z-0.45
N725 X6.293 Y-6.711 F400.
N730 G3 X6.224 Y-6.588 I-0.096 J0.027
N735 G2 X5.547 Y-5.944 I0.271 J0.963 F70.
N740 G1 X1.753 Y-3.753
N745 G3 X1.637 Y-3.764 I-0.05 J-0.087
N750 G2 X-1.637 I-1.637 J1.889
N755 G3 X-1.753 Y-3.753 I-0.066 J-0.076
N760 G1 X-5.547 Y-5.944
N765 G2 X-7.443 Y-5.306 I-0.948 J0.319
N770 X-6.297 Y-4.645 I0.948 J-0.319
N775 G1 X-2.503 Y-2.454
N780 G3 X-2.455 Y-2.349 I-0.05 J0.087
N785 G2 X-0.817 Y0.488 I2.455 J0.474
N790 G3 X-0.75 Y0.582 I-0.033 J0.095
N795 G1 Y4.964
N800 G2 X0.75 Y6.286 I0.75 J0.661
N805 Y4.964 I-0.75 J-0.661
N810 G1 Y0.582
N815 G3 X0.817 Y0.488 I0.1 J0.
N820 G2 X2.455 Y-2.349 I-0.817 J-2.363
N825 G3 X2.503 Y-2.454 I0.098 J-0.019
N830 G1 X6.297 Y-4.645
N835 G2 X6.693 Y-6.605 I0.198 J-0.98
N840 X6.224 Y-6.588 I-0.198 J0.98
N845 G3 X6.101 Y-6.657 I-0.027 J-0.096 F400.
N850 G1 X6.073 Y-6.753
N855 X6.063 Y-6.79 Z-0.442
N860 X6.054 Y-6.821 Z-0.421
N865 X6.048 Y-6.842 Z-0.388
N870 X6.046 Y-6.849 Z-0.35
N875 X6.239 Y-6.903
N880 Z-0.4 F50.
N885 X6.241 Y-6.896 Z-0.438
N890 X6.247 Y-6.875 Z-0.471
N895 X6.256 Y-6.844 Z-0.492
N900 X6.266 Y-6.807 Z-0.5
N905 X6.293 Y-6.711 F400.
N910 G3 X6.224 Y-6.588 I-0.096 J0.027
N915 G2 X5.547 Y-5.944 I0.271 J0.963 F70.
N920 G1 X1.753 Y-3.753
N925 G3 X1.637 Y-3.764 I-0.05 J-0.087
N930 G2 X-1.637 I-1.637 J1.889
N935 G3 X-1.753 Y-3.753 I-0.066 J-0.076
N940 G1 X-5.547 Y-5.944
N945 G2 X-7.443 Y-5.306 I-0.948 J0.319
N950 X-6.297 Y-4.645 I0.948 J-0.319
N955 G1 X-2.503 Y-2.454
N960 G3 X-2.455 Y-2.349 I-0.05 J0.087
N965 G2 X-0.817 Y0.488 I2.455 J0.474
N970 G3 X-0.75 Y0.582 I-0.033 J0.095
N975 G1 Y4.964
N980 G2 X0.75 Y6.286 I0.75 J0.661
N985 Y4.964 I-0.75 J-0.661
N990 G1 Y0.582
N995 G3 X0.817 Y0.488 I0.1 J0.
N1000 G2 X2.455 Y-2.349 I-0.817 J-2.363
N1005 G3 X2.503 Y-2.454 I0.098 J-0.019
N1010 G1 X6.297 Y-4.645
N1015 G2 X6.693 Y-6.605 I0.198 J-0.98
N1020 X6.224 Y-6.588 I-0.198 J0.98
N1025 G3 X6.101 Y-6.657 I-0.027 J-0.096 F400.
N1030 G1 X6.073 Y-6.753
N1035 X6.063 Y-6.79 Z-0.492
N1040 X6.054 Y-6.821 Z-0.471
N1045 X6.048 Y-6.842 Z-0.438
N1050 X6.046 Y-6.849 Z-0.4
N1055 G0 Z15.
N1065 M9
N1070 G53 Z0.
N1075 M30
%
```

Thanks a lot for your help and routine - other than that, it works like a charm!!

Please Log in or Create an account to join the conversation.

*orangecat*on topic

*Manual tool change + tool lengh touch off*

It should be safe to remove this G53 Z0. as it appears to be a part of the tool change routine and there's no X,Y movement that follows.

Alternatively you could just remove the offending line:

from tool-change.ngc .G53 G1 F[#<_TravelFeed>] Z[#5183 - #<_ToolZLast> + #<_ToolZ>] ( return to where we were in Z, adjusting for tool length change )

Please Log in or Create an account to join the conversation.

*hancock*on topic

*Manual tool change + tool lengh touch off*

Please Log in or Create an account to join the conversation.

*clunc*on topic

*Manual tool change + tool lengh touch off*

**that it's designed to work for tool changes within one program; that is, it won't work as intended if M600 is called before the first, roughing, program and M6 is called in a second, separately loaded, finish program.**

*I guessed*But it

**[EDIT: and it was**

*[was] only a guess***. Read on.]. Can you comment whether it's true or not? And if true, if an adjustment might be made to accommodate the different approach?**

__WRONG__Thank you.

(I have to separate passes because the immensity of them put together is too much for the memory.)

Please Log in or Create an account to join the conversation.

*orangecat*on topic

*Manual tool change + tool lengh touch off*

send M600 command

load first file which should contain 1 or more M6 commands.

run it.

load next file which may contain 0 or more M6 commands.

run it.

repeat loading next files and running them until job is complete.

unless you issue another M600 command to indicate start of job, all following files are considered to be part of the same job and may contain M6 commands.

Please Log in or Create an account to join the conversation.

*clunc*on topic

*Manual tool change + tool lengh touch off*

Thank you. It is now transparent, even to this blockhead.

(And it is going to change my life...)

EDIT: It changed my life all right. It is Aug. 18. It was only two weeks ago that I got it working, preparatory to doing the first real job on a new machine. However, the rest of the preparations were equally intense, causing me to

**FORGET ALL ABOUT HAVING SET THIS UP!**This is my Keystone-Kops account of chasing my tail trying to figure out WHY my machine seems possessed and acting on its own--moving to a location that's NOT EVEN IN MY CODE! Turns out

*transparency*is a double-edged sword. (My memory's never been the same since watching

*Memento*...)

Please Log in or Create an account to join the conversation.