Hello Guest it is March 28, 2024, 05:32:02 PM

Author Topic: Mach 3 toolchange for dummies???  (Read 84174 times)

0 Members and 1 Guest are viewing this topic.

Mach 3 toolchange for dummies???
« on: February 20, 2011, 03:38:29 PM »
Hello!

I have done several stepper/mach3 conversions to some of my machines. I most recently converted a Hardinge CHNC Lathe circa 1980.

I have removed the original toolchange internals and now have an 8 position turret that raises and lowers with a 4way solenoid. I have just finished making an 8" .375 pitch timing pulley that fits around the base of the original rotating turret (for stepper motor indexing of the turret)

Within the next few days, I will have an A axis G203V wired to the stepper that will index the indexer.

can you please tell me (in a nutshell) how I can get mach to call for and then execute the toolchange? I feel really lost.

Also, might you have a sample of code that you use to change tools?


Again, for clairity, heres what I want to do-

Call for tool change in G code to tool X
Move to safe tool change position
Activate turret air solenoid (raise)
Index turret to position X
Deactivate turret air solenoid (4 way valve will automaticly lower and lock turret)
Continue executing G code

I hope you can spare a moment to help me...I have almost got the toolchanger ready, and cant figure out how to run it!

Best,
Nate.

natefoerg@gmail.com

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #1 on: February 20, 2011, 04:43:00 PM »
You can use the A axis as rot rollover so 360 will be the max then it will zero again. You can also choose the shortest path option so Mach will move the stepper the shortest path.

Basically what you will need to do is when you home the axis at startup you will also have to home the turret so that Mach knows its position, then the m6start macro will just activate the output needed for the solenoid, move the axis the amount for the requested tool then when finished will deactivate the output and once thats done the macro will exit and Mach will continue.

Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #2 on: February 20, 2011, 05:57:42 PM »
Not the best at VB but just tried this and it seems to work as it should


 If GetSelectedTool() = GetCurrentTool() Then
End
 End If
 
 
 If GetSelectedTool = 1 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A0"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 If GetSelectedTool = 2 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A45"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 
 If GetSelectedTool = 3 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A90"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 If GetSelectedTool = 4 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A135"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 If GetSelectedTool = 5 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A180"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 
 If GetSelectedTool = 6 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A225"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If 
 
 
 If GetSelectedTool = 7 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A270"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 
 If GetSelectedTool = 8 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A315"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If   

 
Hood
Re: Mach 3 toolchange for dummies???
« Reply #3 on: February 20, 2011, 08:22:12 PM »
Thanks hood!

I cut and pasted what you wrote.

where do I store this macro? and what do I write in the g code to call a particular tool?

also any hints on activating "output2"? do I set up an output signal in mach to put out 5v on the output to activate a relay that will power the solenoid?

why did you call it output2?

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #4 on: February 20, 2011, 08:46:49 PM »
You want to save that as m6start.m1s and place it in the macro folder of your profile. For example if you go to Operator menu in Mach  and then VB Script Editor a window will pop up, paste it there then file menu and save as option. Browse to your profiles macro folder (eg C:\Mach2\Macros\Mach3Turn) and call it m6start.m1s. There will likely be already one there so just overwrite it. If you have a custom profile it will be that instead of the Mach3Turn in the example above.

To call a tool in Turn its T0101 (orT101 is the same) T0202......... T0808 
The first two numbers are the turret position (1 to 8 in your case) and the last two are the offset number, in other words the number in the tool table that you have the tool set to. You could for example have a few tools set up ready to place into a turret position so you may want to call T0101 or T0109 or T0117 etc


Output 2 is just what I used in the macro, you can use any of the outputs but obviously you would need to change it in the macro if you used one of the others. For hooking it up you just assign the port and pin number to the OutPut you wil use (2 in this case) and then on the BOB you would hook up a relay to the pin you have chosen, the coil of the relay would need to be 5v and then the contacts of the relay would power your solenoid, whatever that voltage is.


I have not put a Tool Change position in the macro as I prefer to just do that in my code, two reasons mainly, first is I have twin turrets (front and rear) so going to a set position is not always best as I can have tools in the way. Second is I prefer to decide what the position will be for a toolchange depending on the size of the work, that way I dont have a long way to travel.

If you wanted to add a toolchange position in the VB it would be easy enough, just put
Code"G53 G0 X* Z*)
While IsMoving()
Wend

after the first line of each tool, eg
 If GetSelectedTool = 1 Then
 Code"G53 G0 X* Z*)
 While IsMoving()
 Wend
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A0"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If

The * would need to be the position you wish to go to, in machine coords.

Oh and one last thing, I put a Sleep 500 in that is a delay to allow your solenoid to operate before the stepper will move, it is 1/2 second so if you can get away with shorter you can change that, for example Sleep 100 would be 1/10th of a second.



Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #5 on: February 20, 2011, 08:49:58 PM »
Oh yet another thing, make sure you have the A set as I mentioned in the first post, see pic.
Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #6 on: February 20, 2011, 08:54:48 PM »
Oh and that should be C:\Mach3 in the above macro location LOL, its getting late here so thats my excuse for typos :D

Hood
Re: Mach 3 toolchange for dummies???
« Reply #7 on: February 20, 2011, 09:16:19 PM »
Hot damn! (american slang for- excellent info, I am very excited about trying this out)

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #8 on: February 21, 2011, 02:16:19 AM »
LOL

After some sleep I see you wouldnt actually have to put the move to toolchange pos in each section, just having Code "G53 G0 X* Z*" after the first block would work fine.

Like this

 If GetSelectedTool() = GetCurrentTool() Then
End
 End If
 
Code "G53 G0 X* Z*"
While IsMoving()
Wend
 
 If GetSelectedTool = 1 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A0"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 
 
 If GetSelectedTool = 2 Then
 ActivateSignal(OutPut2)
 Sleep 500
 Code "G53 G0 A45"
 While IsMoving()
 Wend
 DeActivateSignal(OutPut2)
 End If
 

Hood
Re: Mach 3 toolchange for dummies???
« Reply #9 on: February 21, 2011, 12:02:40 PM »
Well, I tried It and had moderate success. I can now manually type in a tool number in Mach and then run the vb script editor and it will move the a axis stepper. I can't get it to mOve to position 1 though.

I also can't seem to get it to move to the correct angular position. I just have the a axis stepper sitting on my bench right now so I have the steps set to 200 for one rotation. I also tried 2000 thinking I might need 2000 because of the geckos microsteping.

Additionally, I can't get the a xis to move from g code. I tried inserting t0201 into my code and running it to see if it would index a axis to 90 deg.

Your thoughts?