Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Bertho on June 25, 2024, 09:03:19 PM

Title: My Mach3 array is not working in Mach4
Post by: Bertho on June 25, 2024, 09:03:19 PM
This little code worked fine in Mach3 but not working in Mach4.  I have been hunting for information on registers in Mach4 but not found anything.  Nothing about generating an array either.
.......................
#1001=1 (X counter)
#1002=1 (Y counter)
#1003=15 (X starting point on the stock)
#1004=20 (Y starting point on the stock)
#1005= 95 (X offset par to part)
#1006= 133 (Y offset part t

(== Cut Bases ==)
G00  X[#1003]   Y[#1004]  (1x/1y)
M98 P1001

G00  X[#1003]   Y[#1004+[1*#1006]] (1x/2y)
M98 P1001
...................

Does anyone have an example of an array in Mach4 using a subroutine to share?
Bertho
Title: Re: My Mach3 array is not working in Mach4
Post by: Bill_O on June 27, 2024, 09:07:43 AM
Mach4 is totally different than Mach3.
The code will need to be written for the Mach4
Here is a link to get you started.
https://www.machsupport.com/forum/index.php?topic=45397.msg289143#msg289143 (https://www.machsupport.com/forum/index.php?topic=45397.msg289143#msg289143)
Title: Re: My Mach3 array is not working in Mach4
Post by: Bertho on June 27, 2024, 10:46:18 AM
Thank you so much.  That gives me a good start.
I am surprised though that plain registers are not available as before.
Bertho
Title: Re: My Mach3 array is not working in Mach4
Post by: Bill_O on June 27, 2024, 10:48:00 AM
there are a lot of standard things and you can easily make your own registers.
The Document talks about them
Title: Re: My Mach3 array is not working in Mach4
Post by: SwiftyJ on June 28, 2024, 05:58:40 PM
Go to your mach4hobby installation on your C drive and open the docs folder. You will find a g-code programming manual. Everything you need should be in there
Title: Re: My Mach3 array is not working in Mach4
Post by: Bertho on June 28, 2024, 07:18:14 PM
Thank you,
I have already printed the g-code manual and the LUA one too.  I am working on learning LUA
Title: Re: My Mach3 array is not working in Mach4
Post by: Cbyrdtopper on July 25, 2024, 09:25:43 AM
Your code looks fine, change the #1000's to #100's.
#1016 and #1116 are Inputs and Outputs inside Mach4. 
Since Mach4 emulates a Fanuc 21i, the Fanuc Macro B Programming capabilities in Mach4 are incredible.  I made an entire OD Grinding program based off of screen inputs and read those as #VARS inside my code.
I'm using the #1000 and #1100 variables for the inputs and outputs to look for flags in our auto measuring gauges.

On a DN Solutions DNM5700 we got in 2022 I'm using the same logic to look for inputs from our robot cell so we didn't have to spend thousands of dollars on extra IO Boards for the machine. 
Title: Re: My Mach3 array is not working in Mach4
Post by: Bertho on July 25, 2024, 09:34:57 AM
Thank you so much Chad!! Such a simple solution.