Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 12:18:30 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
ATC VB script example for rotary changer...
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: ATC VB script example for rotary changer... (Read 5096 times)
0 Members and 1 Guest are viewing this topic.
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
ATC VB script example for rotary changer...
«
on:
September 11, 2007, 01:40:35 PM »
I saw a bunch of questions on how to write an ATC so I put one up, it uses the C axis to move the turret/carracell
This script is for a 8 position Rotary Turret tool changer on a Lathe, but you could adapt it to a Mill or any other rotary changer.
Just Change the number of Tools, also you may need to add a tool change point.
It has activation for release and lock of the turret.
You can tick off the use "rotary roll over" tick box so that the angles read better for you under general.
Also, it is a "find the shortest path" to the next tool.
You will need to change the ".txt" to a ".m1s" extension and drop it in your Lathe or Mill, you can drop a C axis to watch the rotorary.
Enjoy,
Scott
M6Start.txt
(0.78 KB - downloaded 614 times.)
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
jastein
Active Member
Offline
Posts: 12
Re: ATC VB script example for rotary changer...
«
Reply #1 on:
September 11, 2007, 09:34:18 PM »
Scott:
Thanks for posting the script!! I am in the finishing stages of a lathe retro fit that has an 8 station turret and a solenoid operated air cylinder to lock/unlock the turret!! It uses a small stepper to index the turret.
I was wondering how I could possibly figure this out! When I get done with that machine, I have a 24 position tool changer on the mill that needs to be controlled by Mach.
Do you have a preference on Parallell, ModIO or Modbus PLC IO for something as simple as the lathe turret?
Again, Thanks for the posting
Jim
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: ATC VB script example for rotary changer...
«
Reply #2 on:
September 12, 2007, 07:22:00 AM »
Jim,
Thanks for replying, I saw 33 downloads but no post back, I was beginning to wonder if anyone thought it helpful.
As far as ATC control type, it depends on complexity of the ATC.
For Simple ATC's (like the one posted), there is not alot of I/O, so parallel is fine for it, and if you doing a mill and your C axis is open you can use it there as well just change the tool number in your carracell and add your I/O for your swap motions.
For medium complexity ATC's that have alot of error/checking and other movements I use a DL06.
for Hight complexity ATC's, that have above plus a "read-a-head" swap arm type tool changer (commecial machines), I use a DL06 with 2 motion control modules, the caracell and swap arm are completly independant of mach, after the tool change mach continues machining and the PLC driven ATC continues on with putting back the old tool, and loading the new tool. So Tool change time is about 2-3 seconds for the swap.
You can do a high complexity lathe as well, by having a Turret and a tail stock turret, you can have your turret for your profile and X movement tools, and your tail for your Drills/live holder.
I have a guy in KY, who wants me to retrofit a "Y axis" lathe with live tooling, now THAT is gonna be fun!!!!.........
scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
cowpoke
Active Member
Offline
Posts: 27
Re: ATC VB script example for rotary changer...
«
Reply #3 on:
September 12, 2007, 08:51:53 AM »
Hi Scott,
Thanks much for the example. When I download and open, I get a one line display. Not knowing VB I don't know how to break it into multiple lines so I could possibly make some sense out of it.
Have I done something wrong in the download or is there another way to download so it will read in multiple lines?
Thanks,
Claude
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: ATC VB script example for rotary changer...
«
Reply #4 on:
September 12, 2007, 10:59:20 AM »
use word wrap
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
drew
Active Member
Offline
Posts: 68
Re: ATC VB script example for rotary changer...
«
Reply #5 on:
October 01, 2007, 12:51:31 PM »
I am working on my HNC tool changing macro. It is changing tools now but the Code "G4 PXX" doesn't work as I expected. And the While loops in the Case statement maynot be holding up the execution of the macro as I ecpected also. Big THANKS poppabear just something to start from is a huge help! OEMTRIG 1-4 are from the original turret encoder signales. The dwell needed between I/O signales seens to be my bigest problem right now. I'm still working on it and insight is appecerated. Anyway here it is.
Sub main()
NumSlots=0
OldTurretPos=(GetOEMDRO(824)) 'current tool position
NextTool = GetSelectedTool() 'tool to be indexed
EncoderBCD = 0 'encoder position is number
TurretLock = False 'turret locked down limit switch
EncoderinPos = False 'NextTool and encoder position match
TestM6 = True 'test run sub replace NextTool value by question
If TestM6 Then 'if test get tool to index
NextTool = Question("Tool to index ")
End If
If NextTool>8 Or NextTool<1 Then 'valid tool check
Message("Next Tool out of range")
Exit Sub
End If
While Not TurretLock Or Not EncoderinPos
If OldTurretPos <> NextTool Then 'if same tool skip index
DeActivateSignal(OUTPUT8) 'Release Turret holding pin
Code"G04 P200"
ActivateSignal(OUTPUT7) 'Rase and rotate Turret
'=== Index Tool ===
Select Case NextTool
Case 1 'Tool#1
While Not(Not IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 2 'Tool#2
While Not(Not IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 3 'Tool#3
While Not(Not IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 4 'Tool#4
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 5 'Tool#5
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 6 'Tool#6
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 7 'Tool#7
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 8 'Tool#8
While Not(IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
End Select
ActivateSignal(OUTPUT8) 'Engauge Turret holding pin
Code"G04 P800"
DeActivateSignal(OUTPUT7) 'Lower and lock Turret
Code"G04 P400"
DeActivateSignal(OUTPUT8) 'Release Turret holding pin
NumSlots=NumSlots+1
End If ' same tool skip
EncoderBCD = ((8*IsActive(OEMTRIG4)) + (4* IsActive(OEMTRIG3)) + (2* IsActive(OEMTRIG2)) + (1* IsActive(OEMTRIG1)))
If NextTool = EncoderBCD Then
EncoderinPos = True
Else 'NextTool and encoder position match
Message("Tool out of Position")
EncoderinPos= False 'NextTool and encoder position match
OldTurretPos= 0
'Code "G04 P500" 'force turret rotation
End If
If IsActive(INPUT1) Then
TurretLock = True 'turret locked down limit switch
Else
Message("Turret not Locked Down")
TurretLock = False 'turret locked down limit switch
OldTurretPos=0 'force turret rotation
End If
Wend 'verify tool in position and turret down
Message("Tool "& NextTool &" loaded " & NumSlots)
SetCurrentTool(NextTool)
End sub
Logged
If I had something important to say it would be here.
drew
Active Member
Offline
Posts: 68
Re: ATC VB script example for rotary changer...
«
Reply #6 on:
October 01, 2007, 03:07:14 PM »
Ok I found out why the dwell was not working(see macro). Macro now works really well. When indexing tool 5 It stops at 7 then goes to 5 but I can live with that. I have not discovered the minimun dwell amount that will work. These do not seem to be too much. The encoder magnet may need to be adjusted for proper operation. I actually look for the tool position before the tool that is requested then check position after it is stoped.The code is ...
Sub main()
NumSlots=0
OldTurretPos=(GetOEMDRO(824)) 'current tool position
NextTool = GetSelectedTool() 'tool to be indexed
EncoderBCD = 0 'encoder position is number
TurretLock = False 'turret locked down limit switch
EncoderinPos = False 'NextTool and encoder position match
TestM6 = True 'test run sub replace NextTool value by question
If TestM6 Then 'if test get tool to index
NextTool = Question("Tool to index ")
End If
If NextTool>8 Or NextTool<1 Then 'valid tool check
Message("Next Tool out of range")
Exit Sub
End If
While Not TurretLock Or Not EncoderinPos
If OldTurretPos <> NextTool Then 'if same tool skip index
DeActivateSignal(OUTPUT8) 'Release Turret holding pin
Code"G04 P200"
While Ismoving()
Wend
ActivateSignal(OUTPUT7) 'Rase and rotate Turret
'=== Index Tool ===
Select Case NextTool
Case 1 'Tool#1 encoder pos8
While Not(IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 2 'Tool#2 encoder pos1
While Not(Not IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 3 'Tool#3 encoder pos2
While Not(Not IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 4 'Tool#4 encoder pos3
While Not(Not IsActive(OEMTRIG4) And Not IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 5 'Tool#5 encoder pos4
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 6 'Tool#6 encoder pos5
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And Not IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
Case 7 'Tool#7 encoder pos6
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And Not IsActive(OEMTRIG1))
Wend
Case 8 'Tool#8 encoder pos7
While Not(Not IsActive(OEMTRIG4) And IsActive(OEMTRIG3) And IsActive(OEMTRIG2) And IsActive(OEMTRIG1))
Wend
End Select
ActivateSignal(OUTPUT8) 'Engauge Turret holding pin
Code"G04 P400"
While Ismoving()
Wend
DeActivateSignal(OUTPUT7) 'Lower and lock Turret
Code"G04 P800"
While Ismoving()
Wend
DeActivateSignal(OUTPUT8) 'Release Turret holding pin
NumSlots=NumSlots+1
End If ' same tool skip
EncoderBCD = 0
If IsActive(OEMTRIG4) Then
EncoderBCD = EncoderBCD + 8
End If
If IsActive(OEMTRIG3) Then
EncoderBCD = EncoderBCD + 4
End If
If IsActive(OEMTRIG2) Then
EncoderBCD = EncoderBCD + 2
End If
If IsActive(OEMTRIG1) Then
EncoderBCD = EncoderBCD + 1
End If
Message("Tool Encoder "& EncoderBCD)
Code"G04 P400"
While Ismoving()
Wend
If NextTool = EncoderBCD Then
EncoderinPos = True
Else 'NextTool and encoder position match
Message("Tool out of Position")
EncoderinPos= False 'NextTool and encoder position match
OldTurretPos= 0 'force turret rotation
End If
If IsActive(INPUT1) Then
TurretLock = True 'turret locked down limit switch
Else
Message("Turret not Locked Down")
TurretLock = False 'turret locked down limit switch
OldTurretPos=0 'force turret rotation
End If
Wend 'verify tool in position and turret down
Message("Tool "& NextTool &" loaded " & "Loop count "& NumSlots)
SetCurrentTool(NextTool)
End sub
Logged
If I had something important to say it would be here.
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: ATC VB script example for rotary changer...
«
Reply #7 on:
October 01, 2007, 04:02:53 PM »
Just a curious finding, your G4 P400 (that is in secondes 400 seconds, unless you have g4 checked in milliseconds).
I know you probably dont want to hear this, but It may be easier to do the timing issues with the timers and the logic in Brian.
Scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
drew
Active Member
Offline
Posts: 68
Re: ATC VB script example for rotary changer...
«
Reply #8 on:
October 02, 2007, 01:16:56 PM »
I am dwelling in milliseconds .The turret is currently indexing to the correct tool every time with an occasional unscheduled stop along the way. Index times run about 4 seconds for a clean stop at the right tool and 8 seconds if it stops at a wrong tool first. I didn't understand the 'logic in Brian' is that a reference to the DL06?
Thanks Drew
Logged
If I had something important to say it would be here.
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: ATC VB script example for rotary changer...
«
Reply #9 on:
October 02, 2007, 05:37:02 PM »
no,
Download the latest Mach3, and open up "Brian editor", it is like a graphically driven soft plc program.
It run much faster and with less cpu than the macro pump. Although, the macro pump is still usufull for more complex things.
Brian has timers and logic, both that you can use ro redo your ATC.
Scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Pages:
1
2
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...