Hello Guest it is April 29, 2024, 12:29:12 AM

Author Topic: Script da mach3 a mach4  (Read 906 times)

0 Members and 1 Guest are viewing this topic.

Script da mach3 a mach4
« on: March 18, 2023, 07:38:38 AM »
Hello, I'm new to the forum. Sorry for my english, I use translator.
I would like to buy mach4 , but before buying, I would like to know if there is anyone who can convert two scripts for mach3 to mach4 . The two scripts are:
1) auto tool zero , which via a 10 mm high touch pad, resets the tool on the piece to be machined.
2) script for manual tool change. This script measures the height of the tool we want to change using a touch pad positioned wherever one wants, then moves to the "tool change" position, we change the tool and the machine returns to the touch pad to measure the height of the new tool, finally it returns to the position where we left off the previous machining. If anyone can convert them, write here. Thanks
Re: Script da mach3 a mach4
« Reply #1 on: March 18, 2023, 07:12:42 PM »
Hi,
Mach4 can be programmed to do as you wish, but......this is the big but......Lua is quite different to VB as is the structure between Mach4 and Mach3.

There is no direct translation from one to the other, there is a distinct learning curve, and most people find that they come to hate Mach4 before they
get accustomed to it and come to love it. It would be reasonable to expect that it could take a month of some very intense learning before you
would be confident to start writing your own code.

The Auto Tool Zero is commonplace and you will find that there are many examples from other forum members that you can copy and adapt to your machine.
Tool changers are much harder because it seems that every tool changer is different to the next, and copying someone else's code is not likely to work,
you have to generate your own.

Mach4 has a very distinct learning curve. You would be advised to allow plenty of time for a transition...if you are under strict time constraints for a business
for example that could make something which is just challenging to really bloody hard!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Script da mach3 a mach4
« Reply #2 on: March 19, 2023, 12:00:23 PM »
Thanks for the reply.
I'm already trying to understand the new mach4 language, but it's hard for me. It's a pity that when they created mach4, they didn't think of creating a little program capable of converting the many scripts created for mach3 that are out there.
Re: Script da mach3 a mach4
« Reply #3 on: March 19, 2023, 02:14:51 PM »
Hi,

Quote
It's a pity that when they created mach4, they didn't think of creating a little program capable of converting the many scripts created for mach3 that are out there.

There is no such thing, nor is there any translation that takes VB code to Lua, they are just too different.

When I made the decision to migrate to Mach4 it was because I was so disgusted with the bugs of VB in Mach3. So by my reckoning its a good thing that there
is such a marked difference between the two.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Bill_O

*
  •  563 563
    • View Profile
Re: Script da mach3 a mach4
« Reply #4 on: March 20, 2023, 08:37:41 AM »
Re: Script da mach3 a mach4
« Reply #5 on: March 20, 2023, 09:35:40 AM »
thank you

Since you are so prepared on mach4, I wanted to ask why some scripts that I found here on the manual tool change forum, don't work, they give errors, but whoever posted it, from what I understand, says it works perfectly. But I want to point out that for now I'm trying with the mach4 demo, I don't know if this is the problem.

Offline Bill_O

*
  •  563 563
    • View Profile
Re: Script da mach3 a mach4
« Reply #6 on: March 20, 2023, 09:56:39 AM »
Most tool change scripts are very specific to the machine.
You get the errors because you are missing some of the things the script is looking for.
You can start with one and modify for your machine.
Re: Script da mach3 a mach4
« Reply #7 on: March 20, 2023, 02:36:59 PM »
Hi,
the problem with tool changers is that they are all different, what will work with one does not work with the other.

The scripts which are released with Mach4 are intended as examples. It may be that one closely approximates your machine so you can copy the script and
modify it to suit. The expectation that your are going to find a script which is exactly right for your machine is doomed to fail.

If you are going to write your own code you'll need:

https://www.lua.org/docs.html

Mach4 uses version 5.3 to my knowledge.

Have you checked out the Mach4 API? It is Mach4Hobby/Doc/Mach4CoreAPI.chm, you'll refer to that document again and again.

My own little contribution for ENUMS, return codes, pound variables and the like is here:

https://www.machsupport.com/forum/index.php?topic=40051.0

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Script da mach3 a mach4
« Reply #8 on: March 21, 2023, 09:21:45 AM »
Meanwhile, thank you for your replies, but for now I must admit that I have great difficulty understanding this " Lua ", it will take some time. I understand that a script can be good for one machine and not another, but the ones for mach3 were written in a generic form and it was enough to adapt only some parameters. For example, the manual tool change was nothing more than a touch pad placed in a position (you entered the coordinates where it was positioned) which measured the length of the old tool, then after the tool change it measured the new one and then returned to the point where you had left the work. I believe that many users who have mach3 and their scripts, not knowing how to write them with " Lua " think about it before switching to mach4.
Re: Script da mach3 a mach4
« Reply #9 on: March 23, 2023, 08:14:02 AM »
hi, I found here a manual tool change script that seems to work, but I have a problem: if I copy the contents of this script in m6.mcs present in the profile macros, when I launch the gcode and the m6 instruction arrives, the script starts automatically. Instead, I would like that when the m6 instruction arrives, it must ask me to press the key I created called "tool change", after which the script must start which will move the axes to a precise point etc etc. How should I do? I tried to copy the original m6.mcs and copied the contents of the script associating it to the key I created, but nothing seems to work. Who helps me? Thanks in advance.