Hello Guest it is April 28, 2024, 01:29:38 AM

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 - Cbyrdtopper

891
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 29, 2015, 08:33:08 AM »
Sorry.  I just figured it out.  It has a drop down to Standard Names and then you can put in a custom name, then in the Mach config. choose the ESS and it will have the drop down with your custom name in it.  Works great!! Thanks again for your help.
If I have any more questions I really hope you don't mind me asking on this thread! 
Again, Thanks for all the help!!!
-Chad

892
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 29, 2015, 08:25:59 AM »
Okay.  So I'm working on the inputs/outputs portion of what you've helped me with.  I have them written in the macro and have a general understanding of the syntax.  But how to I get Mach 4 and the ESS on the same page as far as what outputs and inputs there are.  I am getting drop downs for motor jogging, coolant,  homes, over travel, and etc; I'm not seeing anything as far as Input 1, 2, 3 .... and Output 1,2,3....  Do I have to name them something?

893
General Mach Discussion / Re: Sub Code(“SAVE_XML”)
« on: April 28, 2015, 03:00:58 PM »
That's what I was trying to do inside the macro.  Update my XML.  What about the separate data file?  For my tool magazine positions other than DROs on the screen?  Or just an update of what I have?

894
General Mach Discussion / Re: Sub Code(“SAVE_XML”)
« on: April 28, 2015, 08:10:38 AM »
What I am looking for is a way to save my tool magazine positions.  I have a 24 tool magazine and it changes 2 tools at once.  So I am having to keep track of different magazine positions constantly for tools.  I am using DROs on a custom screen and it works great.  But we're afraid of power failure and losing tool positions in the magazine.  This code would be more of a convenience for us if we can get it to work.  Is there anything special I have to do?  I have it written Code(“SAVE_XML”).  Is this correct?  I'll try it again and look at the date and time to see if it is doing what is should. 

Thanks
-Chad

895
General Mach Discussion / Sub Code(“SAVE_XML”)
« on: April 27, 2015, 05:50:05 PM »
According to Mach3 Version 3.x Macro Programmers Reference Manual you can save your XML in a macro.  I can't seem to get this to work in my macros.  Sub Code(“SAVE_XML”) this is

what is said to use to do this. 

Anyone ever use it?

--Chad

896
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 27, 2015, 08:11:03 AM »
Okay Gerber Baby. That works great!! Thanks!!  ;D  Gonna try the input and output states now!!
-Chad

897
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 24, 2015, 12:10:25 PM »
Okay,  with this code I can get it to work when I hit 'Run' in the macro menu.  I don't have to step through it or anything.  I just hit run and it works.  However, when I switch over to Mach 4 and put it in G Code or MDI line it doesn't do anything.  Does the macro have to be saved a certain way?  It is saved as "m1000.mcs"  or in a certain folder.  It is in the macro folder.  Any Ideas?

function m1000()

local mInst = 0;
local rc = 0;
local inst = mc.mcGetInstance(mInst);

mc.mcCntlMdiExecute(inst, "G00 X5 Y5 \nZ5");

end

if (mc.mcInEditor() == 1) then
    m1000()
end

898
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 24, 2015, 11:56:00 AM »
Okay.  Got something to work finally! Thanks!!  But I can only get it to work when I step through my macro. AND I have to have the 'end' right after the
 function M1002 () otherwise it skips to the end and does nothing.  I am having another problem with running the macro in my MDI line in Mach 4.  I put the 'end' at the end of the macro and where it works when I step through the macro and I get nothing in Mach 4.  Also, earlier I would hit cycle start on the MDI line and it was giving me errors in the message for something in a totally different macro than the one I was trying to run.  Any thoughts on these problems?
Thanks Again!!!
-Chad

899
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 24, 2015, 09:41:26 AM »
Thanks Gerber Baby.  I really appreciate the help.  I'm brand new to lua.  I'm still having problems though.
Here is the macro I am trying:

function M1002() end
local mInst = 0;
local rc = 0;
local inst = mc.mcGetInstance(mInst);
--always start with the above code

mc.mcCntlMdiExecute(G00 X5);
--This moves X to 5

if (mc.mcInEditor() == 1) then     
M1002(); end

When I debug this I get an error on the MDI Execute line.  Saying:  ')' expected near 'X5'

So then I change that line to look like this:
mc.mcCntlMdiExecute(G00 'X5');

At this point it will compile the macro and when I step into it I get to that line again and it says:  McLua ERROR: Lua:  Error while running chunk.

Any thoughts?

900
Mach4 General Discussion / Re: Having trouble with Lua Script
« on: April 23, 2015, 11:22:35 AM »
Thanks Gerber Baby.  I appreciate the help.  But I've looked in the examples and changed small parts of them to try and get them to work.  I can't even get simple G code movement in my macros.  I also don't understand the signal states.  I don't understand the syntax of LUA.  Just getting frustrated.  If anyone can help with a simple macro to do the following that would be great.

Move X to 5
De activate an output1
Wait for input2
Activate output2
Wait for input 3
Move X to position in a user DRO
Message:  Ready to go.

If anyone could help translate this to lua that would be greatly appreciated.  In the meantime I'll try it out some more.
Thanks!
-Chad