Hello Guest it is April 26, 2024, 03:46:19 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 - MitchB

Pages: « 1 2 3 4 5 »
21
General Mach Discussion / Manual tool change with Mill Wizard and Mach 4
« on: January 17, 2016, 01:15:29 PM »
How do I get the machine to stop for a manual tool change after using G code generated by Mill Wizard (e.g. for two lines of holes using two tools)

22
Mach4 General Discussion / Re: Lua Signal Table
« on: January 03, 2016, 10:52:18 AM »
The name of the variable doesn't matter.  It's a function parameter and can be called anything.  But I tried changing it to "state" anyway.  No difference.

23
Mach4 General Discussion / Re: Lua Signal Table
« on: January 02, 2016, 11:28:28 PM »
According to http://www.lua.org/pil/3.6.html, trailing commas are valid in Lua.  I tried deleting it anyway, but it didn't make a difference.

24
Mach4 General Discussion / Re: Lua Signal Table
« on: January 02, 2016, 07:28:45 PM »
your second end

No doubt I've been looking at it too long, but I'm not seeing the problem with any of the end's.

25
Mach4 General Discussion / Re: Lua Signal Table
« on: January 02, 2016, 07:05:04 PM »
I followed your example and have F5 working for feed hold using the PLC script, which is delightful - thanks.

I would also like to see how it works using the signal table.  What I have tried doesn't work and I don't see what is wrong.
At the end of the Screen Load script, I have:

SignalTable = {
    [mc.ISIG_INPUT63] = function (on_off)
        if (on_off == 1) then
            local inst = mc.mcGetInstance();
            mc.mcCntlFeedHold(inst);
        end
    end,
}

At the end of the Signal Script, I have:

if (SignalTable[mc.ISIG_INPUT63] ~= nil) then
    SignalTable[mc.ISIG_INPUT63](state);
end

26
Mach4 General Discussion / Re: Lua Signal Table
« on: January 02, 2016, 12:28:00 PM »
Could someone who understands Lua explain what is going on here?  This reference (http://www.lua.org/pil/3.6.html) describes Lua table constructors.  Based on that, it looks like this:

SignalTable = {001,
     [mc.ISIG_INPUT0] = function (on_off)
        if (on_off == 1) then
            mc.mcCntlCycleStart(inst)
        end
    end
}

would construct a new table stored in SignalTable with [1] = 001 and [mc.ISIG_INPUT0] = function...

1. Why is the 001 needed?
2. If I want to add additional signals and functions, it seems as though I would need to add them to this SignalTable constructor inside the "{}", but in another post it said that the way to do that was to add additional constructors of the form:

SignalTable = {00n,
     [mc.ISIG_INPUTn] = function (on_off)
        if (on_off == 1) then
            ....
        end
    end
}

Wouldn't this overwrite the previous SignalTable declarations?

27
Two Lua questions about your example:

1. Are these table constructors redeclaring SignalTable each time?  Shouldn't all the keys and functions be in one SignalTable?
2. What are the 001, 002, etc. for?

28
Is there a reason you put this in the PLC script instead of the Signal script?

29
Wow.  That's great.  I'm looking forward to trying it.  Thanks a lot.

30
Any chance there are step by step instructions somewhere describing how to do that?

Pages: « 1 2 3 4 5 »