Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 08:22:25 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Re: ATC VB script example for rotary changer...
Pages: 1   Go Down
Print
Author Topic: Re: ATC VB script example for rotary changer...  (Read 817 times)
0 Members and 1 Guest are viewing this topic.
BOB88
Active Member

Offline Offline

Posts: 4


View Profile
« on: June 08, 2008, 12:34:51 PM »

Hi Drew,

Your program has helped me a lot to learn about script with mach3.  My turret has 8 positions, but no raise solenoid or index pins or BCD switches.
It is cycled one turret position by actuating a single air solenoid for about .55 seconds.

The turret is cycling fine by the following script in the file:    M20.m1s      located in the macros folder.

ActivateSignal(Output8)  'mapped to Port1 pin5, applies air to index cylinder
Code "G04 P.55"
While IsMoving()
Sleep 100
Wend
DeActivateSignal(Output8)   'turns off air to index solenoid which completes one index cycle.

So, any time I do M20 the turret advances and locks one position.  Great so far.


Now, I need to come up with the number of cycles or moves needed to get to the desired next tool.
In the M6Start.m1s, I'd like to calculate the unsigned value of the (CurrentTool minus SelectedTool)  which will give me the number of advances necessary to get to the next tool.  Then I can call or execute M20 that number of times to get to the selected tool.

How would you do that?  When you said M6 is not used in lathe but T0101, T0202,etc.  did you mean that M06 does not appear in the G-Code program itself, but just the T-numbers and that MACH3 knows to look at the M6Start when it sees a T-number?  (I noticed that you tested for M6)

Thank you for sharing your knowledge with newcomers to MACH.

BOB88

Logged
Ron Ginger
Active Member

Online Online

Posts: 266



View Profile WWW
« Reply #1 on: June 08, 2008, 05:48:27 PM »

Here is the main part of my tool changer routine. This is a 6 position changer, but you could edit it for more.

tool=getcurrenttool()
'MsgBox ("current tool " & tool)
NewTool= getselectedtool()
'msgbox ("new tool " & NewTool)

if NewTool=tool then
 exit sub
end if

if NewTool>tool then
  steps=Newtool-tool
else
  steps=6 - (tool-NewTool)
End If

If tool Mod 2 Then 'even number
  code "G00 Z 2"
Else
  code "G53 G00 X 0"   'move X to machine home 0
  code "G00 z -2"
End If

'msgbox(" move steps " & steps)

for I=1 to steps
  code "G91 G00 A72"
code "g00 A-12"
code "G90"
While IsMoving()
Wend

next I

The Mod 2 part handles the retract for tool change- the even number slots inmy changer are for boring tools, so I need to retract in Z before a change. The Odd number tools are turning tools, so I want to retract X first.
Logged
BOB88
Active Member

Offline Offline

Posts: 4


View Profile
« Reply #2 on: June 12, 2008, 01:24:24 PM »

I need a way to tell Mach3 what the "currenttool" is at startup.  In other words a way to ask the question "What is the current position of the turret"  and be able to type in the number from 1-8.  That will be the current tool at startup since, without BCD switches, there is no way to know where the turret is without asking. 

Also, how do these programs deal with tool 00 which Mach allows as a legitimate tool number?

Thank you,
Bob

Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!