Hello Guest it is April 27, 2024, 12:41:56 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dhelf

Pages: 1
1
Mach4 General Discussion / Macro from MDI
« on: August 08, 2019, 06:57:21 PM »
I have tried to search the forum so as not to ask redundant questions, but did not find much. How can a macro work perfect in the editor, but not finish from the MDI? It is saved as an mcs extension. At the moment this is on a demo, does that have something to do with it?
Thanks

2
Mach4 General Discussion / Re: Button script
« on: August 08, 2019, 02:14:26 PM »

I am a bit overwhelmed with all the scripts, I thought I could make it more simple and go from there, but after seeing what goes in to a script you are 100% correct, going to start rewriting them this evening. Wish me luck! Going to need some forum assistance with my odd homing cycle this weekend.
Thank god for this forum and helpful people like yourself.

3
Mach4 General Discussion / Re: Button script
« on: August 07, 2019, 08:17:40 PM »
Thank you. I have full intentions of adding end of stroke sensors. I am doing everything I can to keep it simple as mach4 is totally new to me. Have over 32 air cylinders so did not want to confuse myself any further ;)

4
Mach4 General Discussion / Re: Button script
« on: August 07, 2019, 06:40:13 PM »
Ok, I changed the button script to:
local inst = mc.mcGetInstance()
mc.mcCntlMdiExecute(inst, "M127")
It runs about 1/2 the code then stops? But if I load the M127.mcs in the zerobrane editor and run it completes with no problem?

Thanks to everyone for the help

5
Mach4 General Discussion / Re: Button script
« on: August 07, 2019, 06:32:03 PM »
I will give that a try. The sleeps are really not for the code, they are for a delay as the outputs are activating air cylinders and we can not have the next output activated till the cylinder has finished its stroke.

6
Mach4 General Discussion / Re: Button script
« on: August 07, 2019, 05:47:59 PM »
Thanks
I tried that, the issue I have is the screen is not updated during the mc.mcCntlGcodeExecuteWait
Being this function takes a bit of time, and with no axis dro's or output status leds changing it appears it is locking up. It actual runs the code I am just looking for a way to run this code and the screen is updated by clicking a button,

7
Mach4 General Discussion / Re: Button script
« on: August 07, 2019, 03:53:23 PM »
Thank you.
So I changed my button script to
loadFunction()

I then edited my screen load script, and added a function. This is what was added:

function loadFunction()
 local inst = mc.mcGetInstance()
local Stock = mc.mcCntlGetPoundVar(inst, 1050)
local length = (Stock * 12)
local move = (330 - length)
local offset = mc.mcCntlGetPoundVar(inst, 1049)



mc.mcCntlGcodeExecute(inst,"G53 G01 z -0.125 F50\nG53 G00 X 1.00\nG53 G01 A 2.00 F1800")




mc.mcAxisHome(inst,3)
wx.wxMilliSleep(1000)



local osig = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
 mc.mcSignalSetState(osig, 1);

wx.wxMessageBox( "Click Ok once material is on Lift Cylinders")
local osig1 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT9)
 mc.mcSignalSetState(osig1, 1);


wx.wxMessageBox("Verify Cylinders are fully raised and  area is clear for machine movement")

 wx.wxMilliSleep(500)
mc.mcCntlGcodeExecute(inst, "G53 G01 x " .. move .."\n G53 G01 A" .. offset)


 mc.mcSignalSetState(osig, 0);
wx.wxMilliSleep(500)

 

wx.wxMilliSleep(500)
local osig2 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
 mc.mcSignalSetState(osig2, 1);
wx.wxMilliSleep(500)
local osig3 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3)
 mc.mcSignalSetState(osig3, 1);
wx.wxMilliSleep(500)
local osig4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5)
 mc.mcSignalSetState(osig4, 1);

wx.wxMilliSleep( 5000)
 mc.mcSignalSetState(osig3, 0);
wx.wxMilliSleep(500)
 mc.mcSignalSetState(osig4, 0);
wx.wxMilliSleep(1000)
 mc.mcSignalSetState(osig2, 0);
wx.wxMilliSleep(500)
 mc.mcSignalSetState(osig1, 0);


end

It works, however I am missing something on how to control the timing of it all. It does not wait for the movement at begining to complete before proceeding. I read that you can not use Gcodecontrolexecutewait, as I did in my macro. I also read the gcode should be on one single line which I did.
What am I doing incorrect?
Thanks
Dan

8
Mach4 General Discussion / Button script
« on: August 06, 2019, 06:14:46 PM »
I am slowly learning to write the macros I used in Mach3 in lua. I have successfully written 6 of them and when running in the zerobrane editor and watching the diagnostics screen, everything does what it is suppose to. (simulation, not hooked up to machine) I named the macro M127.mcs ok no problem. I want to call the script from a button, in mach3 I just called the actual M127, I assume in Mach4 I should write the script to a button with screen editor? So created a button, in the screen editor, then copy and pasted my M127 script I wrote in to the button script. I did delete the function m127() saved screen. The issue is it will not run the script from the button, at least it will not in its entirety. What am I doing wrong? Is it possible to call a Macro from a button?
Much thanks
Dan

9
Mach4 General Discussion / Re: Request for help
« on: July 28, 2019, 09:28:00 AM »
Thank you for response.
PM sent

10
Mach4 General Discussion / Request for help
« on: July 27, 2019, 06:32:12 PM »
Hello all. I have a tube cutting machine that I have been running with mach3 very successfully. However I am changing it and adding a servo to the rear chuck as well. So there will be 5 axis. X length of tube, Y perpendicular to X, Z torch up/down, A is rotary. I need to slave and axis to "A". In mach3 slave axis must be to x y or z. Other options are to hardware slave or change axis designation. Problem is, the cam software is locked in to the a axis being rotary, and really do not want to edit and change each axis letter from x (or Y) to A every time I make a program. Problem with hardware slaving, is these two chucks are only physically tied together when a tube is loaded. So at start up I need to be able to home each one individually.
I am slowly learning Lua (very slowly) I have 8 custom macros I use in mach3 that I am re writing in lua. Two are done. I am also slowly making a new screen set, it is a very basic screen so has not been to much trouble. While I am sure some day by experimentation and this great forum I can get it all to work, I am a bit under the gun. So my long winded question is does anyone write custom macros or screens? Yes I am willing to pay, and can give the mach3 screen and macros to explain what I need to do. I tried to email a user Poppabear (scott) as I see in his signature he does this line of work but email bounces back?
Thanks

Pages: 1