Hello Guest it is April 19, 2024, 05:21:35 PM

Author Topic: Script for tool changes--- Doable? worth the effort?  (Read 3125 times)

0 Members and 1 Guest are viewing this topic.

Script for tool changes--- Doable? worth the effort?
« on: March 29, 2017, 08:50:23 AM »
So tool changes without an ATC are a pita.. Mostly zeroing Z after the tool change.. So I had a thought, but before I went down the rabbit hole, I figured I would ask if this is doable in the LUA scripts.

(writing this up in Gherkin to help describe the process)

Feature : Calculate new Z-offset with tool change dynamically.
Scenario :
Given the CNC Router was homed and Global coordinates are known
Given that a Touchplate is at a known location in Global coordinates
Given that a tool was zeroed against the work piece
Then the tool is touched off the touchplate to record its global offset.
When a new tool is put in the spindle
Then the CNC Router moves to the touchplate
Then the tool is touched off the touch plate
Then the offset of the new tool is compared with the old tool.

So on paper this seems doable.. but I have never messed with tool tables or tool offsets... So for those that are LUA ninjas... doable? I don't want to go down a rabbit hole if Mach4's API doesn't even support this kind of behavior.

Thanks all

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Script for tool changes--- Doable? worth the effort?
« Reply #1 on: March 29, 2017, 09:51:08 AM »
Well, there isn't too many things that aren't doable in lua. With manumatic tool changes the question is more of it being practical. It sounds like yours is reasonably practical. You will need to do this in 2 parts. Just keep in mind that any automated operation has to be defined by set parameters (until we achieve AI anyway). So here is the way I would do it.

1) Set conditions to manually change the tool: I would simply have the M6 move the spindle to the tool change location, turn off the spindle, coolant, etc. and update the tool number and after motion stops, do a cycle stop.

2) Change Tool: Manually change the tool.

3) Set conditions to resume Gcode execution: Then have a button that moves my spindle to the tool touch location, does the touch routine that sets the tool offset of the current tool and return the spindle to a safe location that the Gcode could be continued from. In your Gcode you would need to make sure it can go from this location to its next working move without issue and set spindle speed, turn the spindle, coolant, vacuum, etc. back on. It might be a good idea to add a move in the Gcode to go to the touch location just after the M6 to. Since it is already there it won't cause any motion but it would insure that the machine is in the position you plan to resume running from every time a M6 is called.

4) Resume Gcode execution: Then you just click Cycle Start to continue running after a tool change. Or...... at the end of your touch routine you could add the cycle start but I would save that for the very last thing after its all proved out.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Script for tool changes--- Doable? worth the effort?
« Reply #2 on: March 29, 2017, 11:31:46 AM »
jhandel,

I believe we have the same goals....
This is what I did for mine:  http://www.machsupport.com/forum/index.php/topic,34484.0.html

I assigned this script to a screen button.
Re: Script for tool changes--- Doable? worth the effort?
« Reply #3 on: March 29, 2017, 11:42:34 AM »
da40flyer : It sure does.... your script is a bit less cluggy too... don't need to worry about keeping track of the old tool location... you just calculate the delta on tool changes..  Tieing this to M6 would be pretty smexy ...  da40flyer, you mind if I take this a few steps further (config screens, trigger on M6 stuff like that?)

Chaoticone: Software developer in me has to ask, is there any type of unit testing framework-ie-ness in Mach4 or do we just write stuff in the debugger and step through it till we are happy? 

Thanks all...


Re: Script for tool changes--- Doable? worth the effort?
« Reply #4 on: March 29, 2017, 12:48:49 PM »
da40flyer, you mind if I take this a few steps further (config screens, trigger on M6 stuff like that?)


Not at all...  I'd love to see what you come up with  :-)
Re: Script for tool changes--- Doable? worth the effort?
« Reply #5 on: March 30, 2017, 06:42:24 PM »
jhandel,

Did you get your script to work?  I am having problems with mine. 
With Hobby 3233 and ESS 195, my machine goes through the script, but after it probes, the next command that moves to machine Z0 is not working properly.  I discovered that as  it jogs Z+ off of the probe, as soon as the probe light goes out, the Z+ movement stops and it moves on to the next line of the script.  Can't figure out why....

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Script for tool changes--- Doable? worth the effort?
« Reply #6 on: March 30, 2017, 06:58:30 PM »
Quote
Chaoticone: Software developer in me has to ask, is there any type of unit testing framework-ie-ness in Mach4 or do we just write stuff in the debugger and step through it till we are happy? 

Debugger is the only tool I have ever used and if there are other ways I don't know what they are. Naturally the core developers have more tools at their disposal using their development environments but for scripting I think the debugger is the only one.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Script for tool changes--- Doable? worth the effort?
« Reply #7 on: March 30, 2017, 07:16:38 PM »
jhandel,

Did you get your script to work?  I am having problems with mine. 
With Hobby 3233 and ESS 195, my machine goes through the script, but after it probes, the next command that moves to machine Z0 is not working properly.  I discovered that as  it jogs Z+ off of the probe, as soon as the probe light goes out, the Z+ movement stops and it moves on to the next line of the script.  Can't figure out why....

Right now I am getting my bearings under how to build UIs for the configurations and moving the logic into a Module for reuse in a button and in an M6 command.. But I haven't gotten to the actual probing logic yet... probably be a few days  till I get there.. Silly work and all getting in the way of my hobby...
Re: Script for tool changes--- Doable? worth the effort?
« Reply #8 on: March 30, 2017, 07:17:45 PM »
Quote
Chaoticone: Software developer in me has to ask, is there any type of unit testing framework-ie-ness in Mach4 or do we just write stuff in the debugger and step through it till we are happy? 

Debugger is the only tool I have ever used and if there are other ways I don't know what they are. Naturally the core developers have more tools at their disposal using their development environments but for scripting I think the debugger is the only one.

Yah, I'm guessing if I wanted to "write" this properly with good testing and suck it would need to be a plugin... which is a whole other ball of wax..

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Script for tool changes--- Doable? worth the effort?
« Reply #9 on: March 30, 2017, 08:36:41 PM »
Quote
Yah, I'm guessing if I wanted to "write" this properly with good testing and suck it would need to be a plugin... which is a whole other ball of wax..

Yup.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!