Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: cncwoodprojects on April 25, 2023, 08:23:11 AM

Title: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 25, 2023, 08:23:11 AM
Hi, first of all THANKS!

I finished to install ATC and first i need to make script work (for the moment i understand the script i started to adapt to my cnc).

I want the possibility to auto return the tool when i finish working (like add a final line in post processor).

Anyone know if mach3 have this option or variable? (or anyone have some script for return the tool to the holder, like read current tool number and return it to position).

Or i need to make a "reverse engineering" the M6start with another name and make a full scripted return macro.

Thanks and sorry for my english.
Title: Re: Return tool to tool holder when finish working.
Post by: Graham Waterworth on April 25, 2023, 09:51:12 AM
you can call T0 M6 and then the script can just put the tool way, the M6Start.m1s code may need to be modified to do it.

Post your script and we can take a look.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 25, 2023, 10:15:51 AM
Thanks, in some days i post the code.

Tomorrow if my work leave me some time i start to test the M6 script and see if all work and i share the code here.

I really appreciate your time  :)
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 26, 2023, 05:49:57 PM
you can call T0 M6 and then the script can just put the tool way, the M6Start.m1s code may need to be modified to do it.

Post your script and we can take a look.

First thanks for your time.

I thinking... is easy adapt one script, but to many hours and i can't make a tool change m6start work i tried to fix and with maybe 8-10 hours only testing i doesn't find the solution (0 knowledge in programing and i stress quickly jejeje).

The problem i have is when i start the scrit in MDI and i write M6 T2, the program prompt with whats is the current toolnum because i have T00 in mach3 and i write 1 the script stop working with a "Invalid tool number request ! [Tool #].


This M6 is part of another script explained in this two videos (one with script explained, and another with video of tool change working):

https://www.youtube.com/watch?v=duULYFBjDnk (https://www.youtube.com/watch?v=duULYFBjDnk)
https://www.youtube.com/watch?v=SLq_s0FQ-SA (https://www.youtube.com/watch?v=SLq_s0FQ-SA)

I take the M6start from this video (copying and trying to learn how it works).

If anyone can help me i really appreciate.
Title: Re: Return tool to tool holder when finish working.
Post by: Graham Waterworth on April 26, 2023, 07:16:07 PM
It looks like you have a few problems :-

1. Make sure you have 'Tool selections persistent' turned on, this will remember the current tool over power downs , see image.  Click the tool DRO on the program run screen, enter a number and press return, exit Mach3 and restart, is the tool number still set?

2. This macro is for a rack type tool changer with no return function so we need to do one for your setup.

3. We need to know the position of the first tool holder relative to the home position and the pitch spacing of the tools.  Output used for the tool release, output used for dust shoe lift if fitted.

With this info we can start and fix your problem.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 27, 2023, 04:01:32 AM
Thanks i really appreciate your time and effort.

It looks like you have a few problems :-

1. Make sure you have 'Tool selections persistent' turned on, this will remember the current tool over power downs , see image.  Click the tool DRO on the program run screen, enter a number and press return, exit Mach3 and restart, is the tool number still set?

2. This macro is for a rack type tool changer with no return function so we need to do one for your setup.

3. We need to know the position of the first tool holder relative to the home position and the pitch spacing of the tools.  Output used for the tool release, output used for dust shoe lift if fitted.

With this info we can start and fix your problem.

1. You are right i activated tool persistent in my setup now (and tool number are remembered if i close mach3 or reboot computer) i post here a image of my config maybe i need to change something more.

2/3. I use a rack type but with every tool in different spacing's.

Because i need to make some "cuts" in my spoilboard for some large tools because my spindle base are low and i need to put the tool holders near the spoil-board and for avoid crushing it.

Some tools can fit and another ones (larger tools like 75mm tools) i need to put in "special" coord because my spoil-board have some spaces and the larger tools go trought this spaces (attached image of my cnc spolboard).

For this reason and dust shoe not retractable (i go to design a dust shoe compatible with my tools, for use it with a tool change without problems) i want prefer to put the coords of every tool holder manually for avoid problems and avoid to put a fixed space between tool holders and if someday i change the cuts of the spoilboard i can change individually this tool coords.

Sorry if i'm not capable to explain this situation in good terms.

In the script i put a false XYZ tool pos for test first in the air see how "emulate" a tool changes and if i see all is good i put the real coords.



When i return from work i go to test if the macro works, i think if this work i'm capable or i go to try and learn to add the inputs and outputs for security sensors of the spindle and the rack pneumatic relay (rack it's easy to add).

Thank you and sorry for my English (I'm from Barcelona).

Another time thanks for your time.
Title: Re: Return tool to tool holder when finish working.
Post by: Graham Waterworth on April 27, 2023, 03:51:07 PM
Here is the latest version of the macro.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 27, 2023, 04:59:44 PM
Here is the latest version of the macro.

Is working, when i set tool nÂș 1 in mach3 and i put m6 t2 the tool 1 go to the tool holder and go to the tool 2 and take it.

Now it's night here and i can't make noise with air compresor but tomorrow i go to test it seriously and say something.

YOU ARE MY HERO jejeje

I really apreciate your time and knowledge!!
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 28, 2023, 02:32:29 PM
Another time thanks!!

I made this modifications in the code (added sensors of open collet and pneumatic tool rack).

I don't tested this code in the machine, tomorrow i think i have time to test it.

I commented a lot of things for learn and help to undestand the code.

I added 2 inputs with a "Const" and added the output of tool rack in the future i wan't to put a limit switch in the tool rack for another input and have this security check if the pneumatic tool rack doesn't move (maybe no air, electrovalve broken...).

I attach the code for make easier for you and avoid copy pastes (and lose the format of the comments).

What do you think about this "newbie trying to do something jajajajajaja".


Thanks another time!

PD: This codes when finish i go to edit correctly trying to explain what do and post the 2 versions or 3 of the code (one only making tool change, another with pneumatic tool sensors and tool rack and maybe another one without pneumatic tool rack. For trying to help another lost people like me).







Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 29, 2023, 07:51:15 AM
Today i have some time this morning i learn one thing about my ATC.

The sensors are for see if the collet are opened when activate the signal for open the tool.
The other one it's strange but i think it's only for see if are tool inside or not. Because i see if i move manually the spindle (rotate by hand) the signal without tool loaded activate only in some grades of the rotation. But if the tool are inside if i rotate the tool doesn't have this "problem".

For this reason i go to rebuild the security checks and i think i need to understant better the IF's, Then, end, end sub because i think i put wrong finishing for this checks.

Latter i put more news.

Pd: if it's possible you can remove the code 2.1 i post (for avoid to some ppl use it and this code are a epic fail jejeje)

Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on April 29, 2023, 12:17:58 PM
Here is the latest version of the macro.

Hi, i tried a lot of things i don't find the solution for read inputs can you correct me this part for see what part i don't understand?
I want to read the input of the collet and open collet and put some security if something fail.

Code: [Select]
'--------------------------------------------------------------------------
Sub PutToolInRack
'Fisrt check if any tool are inside (maybe i made a manual tool change with an independent button i have in the cnc for make manual tool changes)
If Not IsActive(ToolInside) Then
Message("The spindle doesn't have tool inside! and mach3 think i have a tool loaded!!")   'stop the program if i donesnt have tool and mach3 think i have a tool inside
End If

Else 'continue main code
Code "G00 G53 Z" & ZSafe                'Move to Z axis safe
Call WaitMove(100) 'Wait for finish moving to Zsafe
ActivateSignal(ToolRack) 'Activate the pneumatic tool holder
Call ToolPos (OldTool,XPos, Ypos, ZPos) 'Get rack position
Code "G53 X" & Xpos & " Y" & YPosSlide 'Move to sliding position
Call WaitMove(100)
Code "G01 G53 Z" & Zpos & " F" & FFeed 'Move spindle down
Call WaitMove(100)
Code "G53 Y" & Ypos    'Slide tool into rack
Call WaitMove(100)
ActivateSignal(DrawBar) 'Activate the drawbar and release the tool
Sleep(1000) 'Wait 1 second for open the drawbar
Code "G00 G53 Z" & ZSafe 'Move to safe tool height
Call WaitMove (100)
DeActivateSignal(DrawBar)               'Clamp drawbar (without wait for close the collet because it's not needed here).
DeActivateSignal(ToolRack)              'Return tool rack to retract position
'Check if the tool are droped at toolrack
If Not IsActive(ToolInside) Then 'If the collet  doesn't have a tool inside continue main program, but if tool still are inside STOP!!!
Sleep(1000)
Message("Tool number [Tool #" & OldTool & "] aren in tool rack")   'Only for debug and more info
Else
Message("The spindle still have tool inside!!")   '
Sleep(1000)
Exit Sub
End If
'continue main code
Sleep(250)
SpindleEmpty = 0                        'No tool in spindle
End Sub

'------------------------------------------------------------------------

Thanks and sorry for all inconveniences.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 02, 2023, 10:31:51 AM
Bufff, 3 days trying every try i think i make it worse.

If someone can give me some light for take me to the correct path i will be very grateful (and i share all macros with different variants here for all people need it).


Thanks 4 all :)
Title: Re: Return tool to tool holder when finish working.
Post by: TPS on May 03, 2023, 03:01:25 AM
would be helpfull if you post your complete macro code, not only a Sub,
and explain what exactly is not working.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 03, 2023, 03:30:37 AM
would be helpfull if you post your complete macro code, not only a Sub,
and explain what exactly is not working.

Hi and thanks, i post one of my modifications and the working one basic macro.

Basically in my code i made something wrong and never start. I want to understand what i do wrong with this "if, elses,ends..."

I added lines read 2 inputs of mach3, for stop program if collet of atc doesn't open or see if a tool is inside and continue or stop.

I only changed from the original code 2 variables at start of the macro (i don't know if i need to add const or without const this variables) and modified the subs for put in toolrack and getfromtool rack (the second one aren't finished because when i test the macro doesn't work).

Sorry for my bad english. And another time thanks for your time.
Title: Re: Return tool to tool holder when finish working.
Post by: TPS on May 03, 2023, 05:39:57 AM
in here:
Code: [Select]
Sub GetToolFromRack
'Fisrt check if any tool are inside
If IsActive(ToolInside) Then 'If have a tool inside spindle
Sleep(1000)
Message("The spindle have tool inside! and mach3 think i don't have a tool loaded!!")   '
Sleep(1000)
Exit Sub
Else
'Get tool from rack
Code "G00 G53 Z" & ZSafe                'Move Z axis safe
Call WaitMove(100)
ActivateSignal(ToolRack)
Call ToolPos (NewTool,XPos, YPos, ZPos) 'Get tool position
Code "G53 X" & Xpos & " Y" & YPos 'Move to new tool position
Call WaitMove(100)
ActivateSignal(DrawBar) 'Activate the drawbar (open collet)
ActivateSignal(ToolRack) 'Activate the pneumatic tool holder
Code "G01 G53 Z" & ZPos & " F" & FFeed 'Down to engage the tool
Call WaitMove(100)
DeActivateSignal(DrawBar) 'Clamp the tool
Sleep(2000) 'Wait for tool to clamp
'---check of the sensor for see if the tool are loaded with the sensor of the spindle---
??? If Not IsActive(ToolInside) Then 'If the tool aren't loaded (empty tool rack, maybe i extracted the tool manually and i don't put it in the tool rack)
Sleep(1000)
??? End If

??? Else
Code "G53 Y" & YPosSlide 'Slide out of rack
Code "G00 G53 Z" & ZSafe 'Move to Z safe position
DeActivateSignal(ToolRack) 'Retract the pneumatic toolrack
SpindleEmpty = 1                        'Spindle has tool loaded
???
End Sub


your If Then Else conditions are mixed up.
just a first quick view.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 03, 2023, 01:14:46 PM
in here:
Code: [Select]
Sub GetToolFromRack
'Fisrt check if any tool are inside
If IsActive(ToolInside) Then 'If have a tool inside spindle
Sleep(1000)
Message("The spindle have tool inside! and mach3 think i don't have a tool loaded!!")   '
Sleep(1000)
Exit Sub
Else
'Get tool from rack
Code "G00 G53 Z" & ZSafe                'Move Z axis safe
Call WaitMove(100)
ActivateSignal(ToolRack)
Call ToolPos (NewTool,XPos, YPos, ZPos) 'Get tool position
Code "G53 X" & Xpos & " Y" & YPos 'Move to new tool position
Call WaitMove(100)
ActivateSignal(DrawBar) 'Activate the drawbar (open collet)
ActivateSignal(ToolRack) 'Activate the pneumatic tool holder
Code "G01 G53 Z" & ZPos & " F" & FFeed 'Down to engage the tool
Call WaitMove(100)
DeActivateSignal(DrawBar) 'Clamp the tool
Sleep(2000) 'Wait for tool to clamp
'---check of the sensor for see if the tool are loaded with the sensor of the spindle---
??? If Not IsActive(ToolInside) Then 'If the tool aren't loaded (empty tool rack, maybe i extracted the tool manually and i don't put it in the tool rack)
Sleep(1000)
??? End If

??? Else
Code "G53 Y" & YPosSlide 'Slide out of rack
Code "G00 G53 Z" & ZSafe 'Move to Z safe position
DeActivateSignal(ToolRack) 'Retract the pneumatic toolrack
SpindleEmpty = 1                        'Spindle has tool loaded
???
End Sub


your If Then Else conditions are mixed up.
just a first quick view.

Thanks for your reply I'm really confused how to manage the if, then, end if and end sub correctly.

I tried to see the problem and changed the end if i finished the endif for separete the two ifs in the sub, now my head say "for what reason one if stay inside the other if..." and i changed the program for make it in two independent if's.

Like:

Code: [Select]
Sub GetToolFromRack
'First check if any tool are inside
If IsActive(ToolInside) Then 'If have a tool inside spindle
Sleep(1000)
Message("The spindle have tool inside! and mach3 think i don't have a tool loaded!!")   'something failed and the spindle aren't empty
Sleep(1000)
Exit Sub
Else
'Get tool from rack 'start getting the tool from toolrack
Code "G00 G53 Z" & ZSafe                'Move Z axis safe
Call WaitMove(100)
ActivateSignal(ToolRack) 'Activate the pneumatic tool holder
Sleedp(500) 'Little wait for wait pneumatic tool holder (toolrack)
Call ToolPos (NewTool,XPos, YPos, ZPos) 'Get tool position
Code "G53 X" & Xpos & " Y" & YPos 'Move to new tool position
Call WaitMove(100)
ActivateSignal(DrawBar) 'Activate the drawbar (open collet)
Code "G01 G53 Z" & ZPos & " F" & FFeed 'Down to engage the tool
Call WaitMove(100)
DeActivateSignal(DrawBar) 'Clamp the tool
Sleep(2000) 'Wait for tool to clamp
End If   'This part is finished and continue with the next checks for continue the tool change

'---check of the sensor for see if the tool are loaded with the sensor of the spindle---
If Not IsActive(ToolInside) Then 'If the tool aren't loaded (empty tool rack, maybe i extracted the tool manually and i don't put it in the tool rack)
Sleep(1000)
End Sub 'Stop all? maybe not's the correct form for stop the program

Else
Code "G53 Y" & YPosSlide 'Slide out of rack
Code "G00 G53 Z" & ZSafe 'Move to Z safe position
DeActivateSignal(ToolRack) 'Retract the pneumatic toolrack
SpindleEmpty = 1                        'Spindle has tool loaded
End If '

End Sub


All help are very appreciated!
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 03, 2023, 01:31:12 PM
Edit: I added the 0.2 version of the code maybe you want it for see it better all code.

For finish all and abort the tool change (stop the macro) what i neeed to use End sub or Exit sub??? (or maybe another thing)
Title: Re: Return tool to tool holder when finish working.
Post by: TPS on May 03, 2023, 02:45:23 PM
modified your code a bit:

Code: [Select]

'M6 Start, Rack type tool changer with T0 empty tool return
'This macro is made for a ATC with pneumatic tool rack and two sensors in the Spindle (opencollet and closed collet)
'This macro is write by Graham Waterworth from machsupport forum and CncWoodProjects (i learned a lot with Graham it's a profesional programer)
'This macro is FREE and can be modified but can't be sold or used commercially, and mention the creators.
'For the moment this macro is a test but when all working i go to put in a mach3 forum all variables (without sensors, without tool peneumatic and the all in one version).
'Be sure to change the tools positions, inputs and outputs pins corresponding of your machine (every cnc is different).
'First try to test if it's working in the air (put a Zpos above the tools for example in my case my tool rack is in -110 anf for test i used -80 without tool inside).

'--- Variables:------

NewTool = GetSelectedTool()   'Tool required
OldTool = GetCurrentTool()   'Tool in spindle
MaxToolNum = 8 'Maximum number of tools
FFeed = 250                  'Fast feed on and off tool
ZSafe = -5 'Safe Z
DrawBar = Output11 'Output Port of mach3 (open the collet for tool change)
ToolRack = Output12 'Output Port of mach3 for open the output for activate pneumatic tool rack and in future can use this output for raise dust shoe too (at same time if you don't wan't to put an independent output)
Xpos = 0 'X position of tool in rack
YPos = 0 'Y position of tool in rack
ZPos = 0 'Z position of tool in rack
YPosSlide = 264.00 'Safe start for sliding the tool in and out of rack
SpindleEmpty = 0 'Is the spindle empty
'This two variables are for security and see if the tool open and know if a tool is inside
Const OpenColletSensor = 2 'Sensor for see if the collet are openend
Const ToolInside = 1 'Tool are inside the spindle sensor (doesn't work for see if the collet are closed because the sensor only works in some positions of the spindle for see if are closed without tool, but for indicate the tool is inside work in all positions)



'this variables are for future upgrades and are commented
'ToolRackSensor = Input "x"     'When i have time i wan't to add a limit switch for stop the process if the toolrack doesnt move to position (aircompresor off for example).



'-------Security Check: is spindle running? ----
If GetOEMLED (11) Then
Message "Spidnle working STOP the spindle and retry!! ABORT!!!"
Exit Sub
End If



'-------Security check: Is the machine moving? if is moving wait ----
While IsMoving() 'Wait for finish moving
Sleep(100) 'Sleep for avoid cpu consumption
Wend 'continue with the main program




'Check if the requested tool is within range
If OldTool = 0 Then
SpindleEmpty = 0 'No tool in spindle
Else
SpindleEmpty = 1 'Spindle has a tool loaded
End If




'Do we need a new tool
If NewTool = OldTool Then
'I don't need to change tool
Message "Correct Tool already loaded."
Exit Sub
End If

If NewTool = 0 Then
  If SpindleEmpty = 0 Then
  'No tool to put away exit
Else
    'Put tool away
Call PutToolInRack
End If
SetCurrentTool(NewTool) 'Set the NewTool as current tool
Sleep(250) 'Wait for DRO to update
Exit Sub
Else
  If NewTool > MaxToolNum Or NewTool < 0 Then
  'Stop program and exit
    Message "Tool out of range [Tool #" & NewTool & "]"
    Code "M30"
    Exit Sub
Else
  If SpindleEmpty = 0 Then
  'Get new tool
GetToolFromRack
Else
    'Swap tools
Call PutToolInRack
Call GetToolFromRack
End If
SetCurrentTool(NewTool) 'Set the NewTool as current tool
Sleep(250) 'Wait for DRO to update
  End If
End If

End
'--------------------------------------------------------------------------
Sub PutToolInRack
'Fisrt check if any tool are inside (maybe i made a manual tool change with an independent button i have in the cnc for make manual tool changes)
If Not IsActive(ToolInside) Then 'If the collet doesn't have a tool inside
Sleep(1000)
Message("The spindle doesn't have tool inside! and mach3 think i have a tool loaded!!")   'this part i need to polish it because not's necesary to stop the tool change only avoid to put tool in rack because i dont have tool, but for the moment i want to see when i have this problem see what error i made
Sleep(1000)
Exit Sub
Else 'continue main code
Code "G00 G53 Z" & ZSafe                'Move to Z axis safe
Call WaitMove(100) 'Wait for finish moving to Zsafe
ActivateSignal(ToolRack) 'Activate the pneumatic tool holder
Call ToolPos (OldTool,XPos, Ypos, ZPos) 'Get rack position
Code "G53 X" & Xpos & " Y" & YPosSlide 'Move to sliding position
Call WaitMove(100)
Code "G01 G53 Z" & Zpos & " F" & FFeed 'Move spindle down
Call WaitMove(100)
Code "G53 Y" & Ypos    'Slide tool into rack
Call WaitMove(100)
ActivateSignal(DrawBar) 'Activate the drawbar and release the tool
Sleep(1000) 'Wait 1 second for open the drawbar
Code "G00 G53 Z" & ZSafe 'Move to safe tool height
Call WaitMove (100)
DeActivateSignal(DrawBar)               'Clamp drawbar (without wait for close the collet because it's not needed here).
DeActivateSignal(ToolRack)              'Return tool rack to retract position

End If     'This part is finished and can continue to next security check

'Check if the tool are droped at toolrack
If IsActive(ToolInside) Then 'If the collet have a tool inside STOP!!! the tool arent droped
Sleep(1000)
Message("The spindle still have tool inside!!")
Exit Sub

Else    'if tool arent inside all go in right direction
Message("Tool number [Tool #" & OldTool & "] are in tool rack")   'Only for debug and more info
Sleep(1000)
End If

'continue main code
Sleep(250)
SpindleEmpty = 0                        'No tool in spindle
End Sub

'------------------------------------------------------------------------

Sub GetToolFromRack
'First check if any tool are inside
If IsActive(ToolInside) Then 'If have a tool inside spindle
Sleep(1000)
Message("The spindle have tool inside! and mach3 think i don't have a tool loaded!!")   'something failed and the spindle aren't empty
Sleep(1000)
Exit Sub
Else
'Get tool from rack 'start getting the tool from toolrack
Code "G00 G53 Z" & ZSafe                'Move Z axis safe
Call WaitMove(100)
ActivateSignal(ToolRack) 'Activate the pneumatic tool holder
Sleep(500) 'Little wait for wait pneumatic tool holder (toolrack)
Call ToolPos (NewTool,XPos, YPos, ZPos) 'Get tool position
Code "G53 X" & Xpos & " Y" & YPos 'Move to new tool position
Call WaitMove(100)
ActivateSignal(DrawBar) 'Activate the drawbar (open collet)
Code "G01 G53 Z" & ZPos & " F" & FFeed 'Down to engage the tool
Call WaitMove(100)
DeActivateSignal(DrawBar) 'Clamp the tool
Sleep(2000) 'Wait for tool to clamp

'---check of the sensor for see if the tool are loaded with the sensor of the spindle---
If Not IsActive(ToolInside) Then 'If the tool aren't loaded (empty tool rack, maybe i extracted the tool manually and i don't put it in the tool rack)
Sleep(1000)
Message ("No tool in spindle -> Abort")
Sleep(200)
Code "M30" 'stop the program
End If

'we got a tool in spindle so we continue
Code "G53 Y" & YPosSlide 'Slide out of rack
Code "G00 G53 Z" & ZSafe 'Move to Z safe position
DeActivateSignal(ToolRack) 'Retract the pneumatic toolrack
SpindleEmpty = 1                'Spindle has tool loaded
End If '

End Sub



Sub WaitMove(ByVal Dtime As Integer)
  While IsMoving()
    Sleep(Dtime)
  Wend
End Sub

Sub ToolPos(ByVal ToolNumber As Integer, ByRef XPos, ByRef YPos, ByRef ZPos)
'Subroutine to find tool location coordinates
Select Case ToolNumber
Case is = 1 'If the tool number is 1 then read these XYZ positions
Xpos = 112.25 'Here specify  the Machine coords of the tool 1 position.
Ypos = 304.79 'same for all cases
Zpos = -80.00
Case is = 2
Xpos = 212.25
Ypos = 304.79
Zpos = -80.00
Case is = 3
Xpos = 312.25
Ypos = 304.79
Zpos = -80.00
Case is = 4
Xpos = 412.25
Ypos = 304.79
Zpos = -80.00
Case is = 5
Xpos = 512.25
Ypos = 304.79
Zpos = -80.00
Case is = 6
Xpos = 612.25
Ypos = 304.79
Zpos = -80.00
Case is = 7
Xpos = 711.50
Ypos = 304.79
Zpos = -80.00
Case is = 8
Xpos = 111.50
Ypos = 304.79
Zpos = -50.00
End Select
End Sub       


Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 03, 2023, 03:12:24 PM
Thanks another time.

I see the problem i understand i only need to know "if is not active this signal " then "stop, abort!" and no else needed for continue if is active this trigger doesn't start and jump to continuation of the macro.

Tomorrow i go to try more and see if other parts need rework directly in the cnc (testing in air, i configured Z in safe heigh and i can "simulate" this situations).

Another time big thanks and if i finish and make it work (or have more problems) i go to post it here.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 04, 2023, 04:04:05 PM
I halt the process of the macro i found one issue in my ATC.

The tool sensor for see if i have a tool inside have some issues, when i rotate the spindle manually without a tool inside the sensor triggers active sometimes i think the sensor is moved o too close to the clamp. I contacted to the manufacturer for see how to solve this an pray because a Rattm motor spindle is Chinese and find assistance is difficult (they answer al night for me, and when is day they doesn't work).

IF it's impossible to solve (send to china it's discarted)  i have a ATC without tool sensor, only open clamp sensor because i don't want to disassemble the ATC without a tutorial, video or manual of the same spindle.

With this issue the part of the macro for see if too are inside or not never can work correctly and false triggers are more than possible.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 10, 2023, 05:00:42 PM
modified your code a bit:

Impossible to talk correctly with Chinese manufacturer (Rattmotor / Powace in aliexpress).

I go to use the spindle without the tool clamped sensor, if one day i disassemble the spindle for change bearings i go to adjust this sensor, but for the moment i don't want to disassembly the spindle.

Here i post a video for see this issue (short video).

Code: [Select]
https://www.youtube.com/watch?v=MDXX0MyDeL8
I think i right to think this isn't good no?

Tomorrow maybe arrive the rails (12mm non hiwin rails) and start to try the macro.

Thanks another time for your time.
Title: Re: Return tool to tool holder when finish working.
Post by: cncwoodprojects on May 28, 2023, 04:41:39 PM
I post the current working ATC macro with Pneumatic Tool Rack.

This ATC macro for the moment uses only 2 output pins and if you put in mach3 "M6 T0" (call tool 0)  the tool return to the tool holder, i want to put the tool holder in place every time i finish working (works with the current tool, if you have the tool num 2 the tool2 return to tool 2 position in tool rack).

Output 11 for Open collet and blow air at same time for clean the cone and the tool holder (my CSMIO controller is limited and i don't want to use two separated outputs for Opening the tool clamp and blow air)
Output 12 for Pneumatic tool holder

For the moment i don't go to use the Tool sensors, i have some problems with one of the sensors and i want to see with more time if the other sensor works correctly all times.

I tried to comment all lines in the code for help to understand how it work.



For the moment works perfectly without issues. 

This code are possible with the help of TPS and Graham.

Thank for your help i really appreciate your efforts.