Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: mike^3 on August 04, 2013, 03:18:48 PM
-
Hello! ;D
I have a 8 position tool changer turret on my lathe.
I need a tool change macro that will do perform these steps.
Steps:
1. Move carriage to Z0.2 and X0.2 machine zero
2. activate and output (solenoid to raise turret off bed) and keep it activated until the turret is at the right position.
3. rotate clock wise (only 1 direction) to the called for tool, which will be 0-360inches (really degrees) of travel. The tools will be at 45 degree segments, i.e. tool 1 is at 0inch tool 2 is at 90inches.
4. de activate solenoid that raised turret to lock tool in place.
5. continue program.
I assume someone has this macro already done, looked through quite a few posts, and found a few that were close, but did not have a few steps, also, I have 0 experience coding a toolchanger! :)
Any help would be appreciated!!!
Thank u,
Mike
-
First thing you must do is create a way to initialize or refhome the tool turret so Mach3 KNOWS where tool1 is (A0.000 deg).
DO you have a home switch on the turret?
(;-) TP
-
Hi!
I can easily put one on0. And ref the home switch the the A axis. What next?
-
Then you create code to run the turret
ActivateSignal(output1) 'Unlock the turret with air cylinder
If GetCurrentTool() = 1 then
-
Well I lost the code on save I
ll try again
(;-) TP
-
First you create a macro to add to the initiation string found in Gen Config. It is to ref Home the A axis to 0.000
' M1000
ActivateSignal(output1)
Sleep(1000)
RefCombination(8)
While Ismoving()
Wend
DeacctivateSignal(output1)
Sleep(2000)
END
Then create the Turrent code to add to the end of the M6start macro. This code is in simple form and does not contain safety code to verify the Turrent actually unlocked and relocked each cycle. That would require additional safety switches at each end of the stroke of the turrent.
You also have to set the toolchange mode to Auto Tool Change in Gen Config.
ActivateSignal(output1) 'unlock the turrent
Sleep(1000) 'Give it time to move to end of stroke
If GetCurrentTool() = 1 then ' Check for the Tool #
Code"G0 A0.000" ' Move to position
While Ismoving() 'wait for the movement to stop
Wend
End If
If GetCurrentTool() = 2 then
Code"G0 A45"
While Ismoving()
Wend
End If
If GetCurrentTool() = 3 then
Code"G0 A90"
While Ismoving()
Wend
End If
If GetCurrentTool() = 4 then
Code"G0 A135"
While Ismoving()
Wend
End If
If GetCurrentTool() = 5 then
Code"G0 A180"
While Ismoving()
Wend
End If
If GetCurrentTool() = 6 then
Code"G0 A225"
While Ismoving()
Wend
End If
If GetCurrentTool() = 7 then
Code"G0 A270"
While Ismoving()
Wend
End If
If GetCurrentTool() = 8 then
Code"G0 A315"
While Ismoving()
Wend
End If
DeacctivateSignal(output1) 'Release air cylinder
Sleep(2000) 'Give it time to move to end of stroke
End
THAT is it in a nut shell, (;-) TP
-
So.....would the final code be this?
' M1000
ActivateSignal(output1)
Sleep(1000)
RefCombination(8)
While Ismoving()
Wend
DeacctivateSignal(output1)
Sleep(2000)
END
ActivateSignal(output1) 'unlock the turrent
Sleep(1000) 'Give it time to move to end of stroke
If GetCurrentTool() = 1 then ' Check for the Tool #
Code"G0 A0.000" ' Move to position
While Ismoving() 'wait for the movement to stop
Wend
End If
If GetCurrentTool() = 2 then
Code"G0 A45"
While Ismoving()
Wend
End If
If GetCurrentTool() = 3 then
Code"G0 A90"
While Ismoving()
Wend
End If
If GetCurrentTool() = 4 then
Code"G0 A135"
While Ismoving()
Wend
End If
If GetCurrentTool() = 5 then
Code"G0 A180"
While Ismoving()
Wend
End If
If GetCurrentTool() = 6 then
Code"G0 A225"
While Ismoving()
Wend
End If
If GetCurrentTool() = 7 then
Code"G0 A270"
While Ismoving()
Wend
End If
If GetCurrentTool() = 8 then
Code"G0 A315"
While Ismoving()
Wend
End If
DeacctivateSignal(output1) 'Release air cylinder
Sleep(2000) 'Give it time to move to end of stroke
End
Ill check and see if it works, also you mentioned safety switches? Would this be a switch that would sense the turret up, and then if it doesnt get the signal it will estop?
THANKS!
-
Actually I forgot a piece of the code that moved to Machine location here is an updated version to include that part. What you see here is 2 parts first the Macro that will initiate the Turrent and ref home the turrent on Mach3 startup. It is macro M1000. The 2nd part is the code that goes in the M6Start macro that drives the tool changer based on Tool#. YES the extra switches would be to tell IF the turrent reach full unlock and full lockup or else the Machine STOPS.
' M1000
RefCombination(1)
While Ismoving()
Wend
RefCombination(4)
While Ismoving()
Wend
Code"G53 X0.2"
While Ismoving()
Wend
Code"G53 Z0.2"
While Ismoving()
Wend
ActivateSignal(output1)
Sleep(1000)
RefCombination(8)
While Ismoving()
Wend
DeacctivateSignal(output1)
Sleep(2000)
END
Then create the Turrent code to add to the end of the M6start macro. This code is in simple form and does not contain safety code to verify the Turrent actually unlocked and relocked each cycle. That would require additional safety switches at each end of the stroke of the turrent AND a few more lines of code .
You also have to set the toolchange mode to Auto Tool Change in Gen Config.
Code"G53 X0.2" 'Move to tool change location
While Ismoving()
Wend
Code"G53 Z0.2"
While Ismoving()
Wend
ActivateSignal(output1) 'unlock the turrent
Sleep(1000) 'Give it time to move to end of stroke
If GetCurrentTool() = 1 then ' Check for the Tool #
Code"G0 A0.000" ' Move to position
While Ismoving() 'wait for the movement to stop
Wend
End If
If GetCurrentTool() = 2 then
Code"G0 A45"
While Ismoving()
Wend
End If
If GetCurrentTool() = 3 then
Code"G0 A90"
While Ismoving()
Wend
End If
If GetCurrentTool() = 4 then
Code"G0 A135"
While Ismoving()
Wend
End If
If GetCurrentTool() = 5 then
Code"G0 A180"
While Ismoving()
Wend
End If
If GetCurrentTool() = 6 then
Code"G0 A225"
While Ismoving()
Wend
End If
If GetCurrentTool() = 7 then
Code"G0 A270"
While Ismoving()
Wend
End If
If GetCurrentTool() = 8 then
Code"G0 A315"
While Ismoving()
Wend
End If
DeacctivateSignal(output1) 'Release air cylinder
Sleep(2000) 'Give it time to move to end of stroke
End
-
Awesome, so....
You mentioned that I need to add the tool change macro to the end of m6start, yet it already has the end command do i just delete the END command and post it?
' M1000
RefCombination(1)
While Ismoving()
Wend
RefCombination(4)
While Ismoving()
Wend
Code"G53 X0.2"
While Ismoving()
Wend
Code"G53 Z0.2"
While Ismoving()
Wend
ActivateSignal(output1)
Sleep(1000)
RefCombination(8 )
While Ismoving()
Wend
DeacctivateSignal(output1)
Sleep(2000)
END *********************************this
Also you had mentioned the turret homing, when I click the ref all home, I can see that the m1000 (m1000 is homing right?) is the ref all home on startup right? And I see RefCombination(1) and RefCombination(4) and RefCombination(8 ) What are these? I am setting the A axis as the turret, so wouldnt it be something like this in there:
ActivateSignal(output1)
Sleep(1000)
RefCombination(8 ) ********************what does this do?*************************
While Ismoving()
Wend
DeacctivateSignal(output1)
Sleep(2000)
END
Code"G53 A0" *********************wouldnt this need to be in there?******************
While Ismoving()
Wend
Also what would be the code for sensing the turret is up and down before continuing?
Something like
DeacctivateSignal(output1)
Then wait for 5v on Input 1 if no input within 5 secs, display message *turret not in position* with 2 option buttons is turret down? YES/NO if clicked yes, then continue the program, if no then estop the machine
I know your helping me a ton, I really really really appreciate it!
-
OK lets start over. THe M1000 is a macro you have to create via the CB editor. Then save it in the Macros directory. Next on the initiation line in Gen config you add the M1000 to the code that is already there.
That tells Mach3 when it starts up to RUN the macro code. It should refhome the machine then Refhome the turrent. NOW the machine knows where it is in machine space.
Next is the Code to ADD to the M6start macro . THat code drives the turrent when a tool change is called.
To add the end of stroke switches code it is ;
Code"G53 X0.2" 'Move to tool change location
While Ismoving()
Wend
Code"G53 Z0.2"
While Ismoving()
Wend
ActivateSignal(output1) 'unlock the turrent
While not Isactive(output2) 'wait for the switch to signal end of stroke
Sleep(1000) 'Give it time for the motion to fully stop
Wend
If GetCurrentTool() = 1 then ' Check for the Tool #
Code"G0 A0.000" ' Move to position
While Ismoving() 'wait for the movement to stop
Wend
End If
If GetCurrentTool() = 2 then
Code"G0 A45"
While Ismoving()
Wend
End If
If GetCurrentTool() = 3 then
Code"G0 A90"
While Ismoving()
Wend
End If
If GetCurrentTool() = 4 then
Code"G0 A135"
While Ismoving()
Wend
End If
If GetCurrentTool() = 5 then
Code"G0 A180"
While Ismoving()
Wend
End If
If GetCurrentTool() = 6 then
Code"G0 A225"
While Ismoving()
Wend
End If
If GetCurrentTool() = 7 then
Code"G0 A270"
While Ismoving()
Wend
End If
If GetCurrentTool() = 8 then
Code"G0 A315"
While Ismoving()
Wend
End If
DeacctivateSignal(output1) 'Release air cylinder
While NOT Isactive(output3)
Wend
Sleep(1000) 'Give it time to complete end of stroke
End
(;-) TP
-
Awesome, I have one last question :)
ActivateSignal(output1) 'unlock the turrent
While not Isactive(output2) 'wait for the switch to signal end of stroke *************************For this line, should it be input 2 not output 2 for sensing the turret up position?
Sleep(1000) 'Give it time for the motion to fully stop
Thanks
Mike
-
INPUT2 , Sorry
(;-) TP
-
Hey BR :) I needed to modify the tool change and use a rotary air cylinder, can we make this work?
This is what needs to happen, I have searched the forums and came up with nothing even close.
Here it is, operations in the tool change:
Call up selected tool (1 through 8 )
do nothing if at the current tool selected
if not at the tool then these steps must happen.
(lets say for example the tool is at tool position 2, and I call up tool 1)
move x0.2 z-0.2 (Machine coordinates)
Activate solenoid 1 (de activates lathe stop dog)
Activate solenoid 2 (pop up lathe turret)
Activate solenoid 3 (activates air driven worm gear and turns turret in only 1 direction)
Wait for signal from input 1 (no other input) (there are mechanical switches that all give off 5v once the rotary disc is in position, but input 1 means tool 1, input 2 means tool 2, input 3 means tool 3, etc. etc.)
Once it receives signal from input 1 (or input 1-8 depending on which tool is capped for):
Deactivate solenoid 1 (to stop the turret from spinning)
Deactivate solenoid 3 (stoped airdriven worm gear)
Deactivate solenoid 2 (drops turret into locked seat)
Update DRO and tool offsets
Return to program.
Any ideas?
Thanks :)
-
could someone send me a wiring diagram from tool turret motor to mach3 controller for using this program ? pleaseeee I need some help for my last project on my college :( this is my email ariawanbayu11@gmail.com , thank you guys.