Manual tool change + tool lengh touch off
- maciej.gornicz
- Offline
- New Member
- Posts: 1
- Thank you received: 0
I also am using Fusion360 and linuxcnc. I struggle with this problem for some time and still could not create the ideal procedure. With gratitude I'll use your files . Please share if possible.
Maciej
Please Log in or Create an account to join the conversation.
Hy friends!
I try to optimize my manual tool change subroutine, I have tried changing the place of the M6 command several times but it always gives me error. Look at the video and you will realize that always before starting to mill the router goes to the tool change position resulting tedious and expensive in time matter, please aid me to avoid this unnecessary movement, any advice is welcome. Thanks
It's not obvious from that video what the complete tool change routine looks like. Besides, it doesn't look like anything in the code you've posted is producing that extra move. I notice you reference _ini[TOOLSENSOR] for a number of variables. It's worth double checking that for extra XY moves.
Also, double check your machine .INI for the following line TOOL_CHANGE_POSITION. You shouldn't have one of these enabled which would cause an extra move.
Does the extra move occur when you do a manual Tn M6 in MDI or is it only when you run a program?
Luke.
Please Log in or Create an account to join the conversation.
- eFalegname
- Offline
- Elite Member
- Posts: 253
- Thank you received: 30
You were right, I solved changing the line TOOL_CHANGE_POSITION=... for the ini section [TOOL
_CHANGE_POSITION]... and modifying the statement: O200 ELSEIF, now I can place my files.
There was some sort of offset in X and Y that was added after the third tool change, by deleting the G49 after M70 in the M6 file "tool-change.ngc" the problem has gone.
I'd be interested in finding additional optimizations for my machine configuration. Let's see if in these days I can make the video to better illustrate the process of my manual tool change.
M600 remap file:
O<tool-job-begin> SUB
( Filename: tool-job-begin.ngc )
( LinuxCNC Manual Tool-Change Subroutines for Milling Machines version 1.1: subroutine 2/2 )
( Intended to be run as a remapped M600 command. Used to indicate that the next tool change, M6, is the first tool of a job. )
#<_ToolDidFirst> = 0 ( new job, we haven't yet called <tool-change> for the first time )
(debug, utensile #<_ToolDidFirst>)
G49 ( clear tool height adjustment )
O<tool-job-begin> ENDSUB
M2
Z zero touch plate probe file:
o<tool-zero>sub
#<_ToolDidFirst> = 0 ( new job, we haven't yet called <tool-change> for the first time )
(DEBUG, utensile riferimento programma #<_ToolDidFirst>)
G49 ( clear tool height adjustment )
M9
M5
G80
G91
G94
G40
G4 P1
G38.2 Z[#<_ini[TOOLSENSOR]ZSEARCH>] F[#<_ini[TOOLSENSOR]PROBEFEED1>]
G0 Z#<_ini[TOOLSENSOR]PROBERETRACT>
G38.2 Z[#<_ini[TOOLSENSOR]PROBERETRACT>*-1.25] F#<_ini[TOOLSENSOR]PROBEFEED2>
G4 P0.05
O102 IF [#<_hal[pyvcp.set_all_zero]>]
G10 L20 P1 Z#<_ini[TOOLSENSOR]H>
G10 L20 P2 Z#<_ini[TOOLSENSOR]H>
G10 L20 P3 Z#<_ini[TOOLSENSOR]H>
G10 L20 P4 Z#<_ini[TOOLSENSOR]H>
G10 L20 P5 Z#<_ini[TOOLSENSOR]H>
G10 L20 P6 Z#<_ini[TOOLSENSOR]H>
G10 L20 P7 Z#<_ini[TOOLSENSOR]H>
G10 L20 P8 Z#<_ini[TOOLSENSOR]H>
G10 L20 P9 Z#<_ini[TOOLSENSOR]H>
( MSG, Zero Z > Tutti Work-Offsets )
O102 ELSE
G10 L20 P0 Z#<_ini[TOOLSENSOR]H>
O102 ENDIF
M9
G90
G53 G0 Z-5
o<tool-zero>endsub
M2
M6 remap file:
O<tool-change> SUB
( see: http://www.linuxcnc.org/index.php/english/forum/10-advanced-configuration/5596-manual-tool-change--tool-lengh-touch-off?start=30#48235 )
#<Tool>=#<_current_tool>
O100 IF [EXISTS[#<_ToolDidFirst>] EQ 0]
#<_ToolDidFirst> = 0
O100 ENDIF
O105 IF [#<_ToolDidFirst> EQ 0]
G49
O105 ENDIF
G49
M6
M70
M9
M5
G90
G94
G40
O200 IF [#<_ToolDidFirst> EQ 0]
G53 G0 Z-5
G53 G0 X#<_ini[TOOLSENSOR]X> Y#<_ini[TOOLSENSOR]Y>
G53 G1 F#<_ini[TOOLSENSOR]PROBEFASTFEED> Z#<_ini[TOOLSENSOR]Z>
G91 G54 G1 F#<_ini[TOOLSENSOR]PROBEFEED1>
G38.2 Z[#<_ini[TOOLSENSOR]ZSEARCH> - #<_ini[TOOLSENSOR]Z>] F#<_ini[TOOLSENSOR]PROBEFEED1>
G0 Z#<_ini[TOOLSENSOR]PROBERETRACT>
G38.2 Z[#<_ini[TOOLSENSOR]PROBERETRACT>*-1.25] F#<_ini[TOOLSENSOR]PROBEFEED2>
M9
G90
#<_ToolZRef> = #5063
#<_ToolZLast> = #<_ToolZRef>
G53 G0 Z-5
M72
#<_ToolDidFirst> = 1
O200 ELSEIF [#<_current_tool> EQ #<Tool>]
#<_ToolZLast> = #<_ToolZRef>
G53 G0 Z-5
M72
#<_ToolDidFirst> = 1
O200 ELSE
G53 G0 Z-5
#<ToolDiamMM> = #5410
O102 IF [#<_current_tool> EQ 0 AND #<ToolDiamMM> EQ 0]
G53 G0 Z-5
G30
(MSG, Cambiare la fresa e premere Start )
O102 ELSE
G53 G0 Z-5
G30
(DEBUG, Mettere la fresa #<_current_tool> diametro #<ToolDiamMM>mm, poi premere Start )
O102 ENDIF
M0
G53 G0 X#<_ini[TOOLSENSOR]X> Y[#<_ini[TOOLSENSOR]Y>]
G53 G1 F#<_ini[TOOLSENSOR]PROBEFASTFEED> Z#<_ini[TOOLSENSOR]Z>
G91 G54 G1 F#<_ini[TOOLSENSOR]PROBEFEED1>
G38.2 Z[[#<_ini[TOOLSENSOR]ZSEARCH>] - #<_ini[TOOLSENSOR]Z>] F[#<_ini[TOOLSENSOR]PROBEFEED1>]
G0 Z#<_ini[TOOLSENSOR]PROBERETRACT>
G38.2 Z[#<_ini[TOOLSENSOR]PROBERETRACT>*-1.25] F[#<_ini[TOOLSENSOR]PROBEFEED2>]
M9
G90
#<_ToolZ> = #5063
G53 G0 Z-5
#<_ToolZLast> = #<_ToolZ>
M72
G43.1 Z[#<_ToolZ> - #<_ToolZRef>]
#<_ToolDidFirst> = 1
O200 ENDIF
O<tool-change> ENDSUB
M2
Changes in .ini file:
[RS274NGC]
RS274NGC_STARTUP_CODE = M600
FEATURES =30
REMAP=M6 modalgroup=6 ngc=tool-change
REMAP=M600 modalgroup=6 ngc=tool-job-begin
[TOOLSENSOR]
X = 50
Y = 517
Z = -110
H = 11.25
ZSEARCH = -170
PROBEFASTFEED = 1800
PROBEFEED1 = 250
PROBEFEED2 = 25
PROBERETRACT = 0.5
[PARKING_POSITION]
X = 10
Y = 600
Z = -5
[TOOL_CHANGE_POSITION]
X = 50
Y = 50
Z = -5
[EMCIO]
TOOL_CHANGE_QUILL_UP = 1
Additional macros:
o <g28> sub
G90 G0 G53 Z-5
G53 G0 X[#<_ini[PARKING_POSITION]X>] Y[#<_ini[PARKING_POSITION]Y>]
G53 G0 Z[#<_ini[PARKING_POSITION]Z>]
G28.1
o <g28> endsub
M2
o <g30> sub
G90 G53 G0 Z-5
G53 G0 X[#<_ini[TOOL_CHANGE_POSITION]X>] Y[#<_ini[TOOL_CHANGE_POSITION]Y>]
G53 G0 Z[#<_ini[TOOL_CHANGE_POSITION]Z>]
G30.1
o <g30> endsub
M2
Please Log in or Create an account to join the conversation.
- eFalegname
- Offline
- Elite Member
- Posts: 253
- Thank you received: 30
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
- Posts: 267
- Thank you received: 42
Are the files above the ones that are used in the videos? I am setting up a new gmoccapy machine and I love how yours works....
Please Log in or Create an account to join the conversation.
I am struggling to understand this information.
Here is the problem:
I am unable (hardware wise) to set my tool lengths manually to keep my z-axis at zero.
I am using r8 collets.
This thread seems like the solution to all my worries.
My understanding is that I need to make a routine or macro to run my end mill down to a touch plate in order to reset z-axis to zero.
Is this correct?
If that is the case. I need make a m6 routine and then install it in a location that linuxcnc will look for it. There will also be another file to say where the touch off plate is located. There will also be a file saying I have a touch off plate that gets wired to my c10 breakout board.
Can anyone tell me if I am close to understanding this? IF you are able to please correct me where I am wrong and also point me in the right direction.
Thank you very much for your time.
Very Respectfully,
-swalts
Please Log in or Create an account to join the conversation.
**EDIT to keep reply short**
Can anyone tell me if I am close to understanding this? IF you are able to please correct me where I am wrong and also point me in the right direction.
Thank you very much for your time.
Very Respectfully,
-swalts
You understanding is on the right track. I will explain my setup to help you understand. I've also been asked to do an instructional video from a video I posted on YouTube of the routine working, so I will get that done soon and post a link here.
Setup required:
1. custom sub-routine invoked by M6
2. touch-off plate somewhere on your mill configured as an input
3. change to ini file to remap M6 command to new sub-routine
4. determine XY position of touch-off plate and height of plate from table.
How it works:
- An M6 (either manual or in your G code) calls the sub-routine.
- The sub moves the mill head to a predetermined location in XY and then moves towards the touch-off plate to probe.
- A successful contact triggers the probe and the Z position is used to calculate tool length.
- The tool length is then written to your tool offset table.
- Sub-routine ends and the new tool is called from the tool offset table with the correct length.
How mine works
- I have top of Z set as zero and towards table is a negative value
- I split my G code into separate files for each tool change. Although the tool measure routine could allow you to run multiple tool changes in one file I prefer the accuracy off touching off each time with the new measured tool length.
How I make a part;
1. Home machine
2. Load G code file
3. in MDI - Tn M6 (where n is tool number) - this invokes the sub-routine and measure tool length offset
4. Jog to part and touch off top using manual jog down and LinuxCNC touch-off drop-down G54 etc..
5. Run code.
6. Load next G code file, rinse and repeat steps 3-5
Hope this helps
Luke.
Please Log in or Create an account to join the conversation.
I need make a m6 routine and then install it in a location that linuxcnc will look for it.
Yes, this, at it's simplest, would be a single G-code file, and LinuxCNC would know to look for that file rather than do a normal M6 because of the INI setting
[RS274NGC]
...
REMAP=M6 ngc=mym6file.ngc
However, it isn't _quite_ as simple as that, because your g-code needs to know what tool-number was passed in the T-word in order to set the length of the correct tool. That is where the tool_change_prolog Python code comes in.
linuxcnc.org/docs/2.7/html/remap/remap.h...s_including_tt_m6_tt
Actually, if you are not using tool-radius compensation you could go for an even easier answer, where you always put the offset in the tool1-slot of the tool table, and M6 T5 would actually put the offset in slot1, and do an M6 T1 G43 H1 in the remapped G-code. Then your routine doesn't need to know the actual tool number.
There is a complete demo config installed with LinuxCNC. But here are links to the relevant parts of those files.
github.com/LinuxCNC/linuxcnc/blob/master...altoolchange.ini#L56
github.com/LinuxCNC/linuxcnc/blob/master...es/manual_change.ngc
You should probably use this file rather than write your own, it is set up to do the right things in error conditions.
Note that this code gets the tool change position from the INI file (lines 16 and 17). You could hard-code it in the G-code for your machine.
There will also be another file to say where the touch off plate is located. There will also be a file saying I have a touch off plate that gets wired to my c10 breakout board.
The location can be in the INI (as in the example above) or hard-coded in the G-code. The choice is yours, but using the INI requires turning on G-code access to the INI file, which happens in line 46 of that sample INI (Features = 30)
The probe is configured by a couple of lines in your HAL file, not in an extra file.
Please Log in or Create an account to join the conversation.
You may be the same person I subscribed to and asked to make a video about this very same subject.
to quote your previous post:
Setup required:
1. custom sub-routine invoked by M6
2. touch-off plate somewhere on your mill configured as an input
3. change to ini file to remap M6 command to new sub-routine
4. determine XY position of touch-off plate and height of plate from table.
The sub-routine looks for M6, when it finds it then it halts the machine tells me to insert a tool (Tn M6?).
Then after i change the tool it runs over to the location where i tell it to touch off the plate.
The process sounds simple enough. I think my hang up is where do i tell linuxcnc or fusion360 to invoke sub-routine on M6? How do i find the program (even an example copy) to remap m6 command to the new sub-routine?
Thank you again for your time.
-swalts
Please Log in or Create an account to join the conversation.
Thank you for the links and the explanation. From your post its seems that all the files are already installed with linuxcnc. I just need to find them? I then write a couple of lines of code in the hal file (is that the posthalgui file?).
Really it looks like i only need the .ngc file for the remap m6 and then only write the codes for the touch off plate. Also i need to modify the .ini file to look for remap m6.
Am i following correctly?
thank you for your help.
-swalts
Please Log in or Create an account to join the conversation.