Hello Guest it is April 27, 2024, 05:47:14 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 - Screwie Louie

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »
111
Mach4 General Discussion / v2336 Keyboard Simulator plugin
« on: June 05, 2015, 01:17:25 PM »
...the working one

Attached is the keyboard simulator plugin from m4 ver. 2336.

Just delete the keyboard sim from your plugin folder and paste this one in. It works like a charm. I have 30 inputs mapped to functions.

Below is some sample code to put into your signal table/library in the screen load up script. You can map keys straight from m4 input tabs under configuration for jogging. You can really do a lot with it.

I would recommend when you map a key to have the Caps Lock on. This way when you type the keyboard sim doesn't interfere.

I can manipulate mach4 using the keyboard simulator with my Bluetooth keyboard away from the computer. It is also good to simulate probe inputs to test code with using the Mach4 Simulator plugin (as a motion controller sim).

--josh

Code: [Select]
--Keyboard Sim 'Return' w/Caps Lock on to enable Mach 4.
    sigLib[mc.ISIG_INPUT60] = function (state)
        local inst = mc.mcGetInstance ()
        local hSig = mc.mcSignalGetHandle (inst, mc.OSIG_MACHINE_ENABLED)
        local sigState = mc.mcSignalGetState (hSig)

        if state == 1 then
            if sigState == 0 then
            mc.mcSignalSetState (hSig, 1)
            elseif sigState == 1 then
            mc.mcSignalSetState (hSig, 0)
            end
        end
    end

    --Keyboard Sim 'C' w/Caps Lock on to center table.
    sigLib[mc.ISIG_INPUT61] = function (state)
        local inst = mc.mcGetInstance ()
        local gCode = ""
        if state == 1 then
            gCode = "G00 G90 X9.0 Y2.0 Z0.0 \n"
            mc.mcCntlMdiExecute (inst, gCode)
        end
    end

    --Keyboard Sim 'Esc' for Estop.
    sigLib[mc.ISIG_INPUT62] = function (state)
        local inst = mc.mcGetInstance ()
        local rc = 0
        mc.mcCntlEStop (inst, 1)
    end

    --Keyboard Sim 'H' w/Caps Lock on to home all axes.
    sigLib[mc.ISIG_INPUT63] = function (state)
        local inst = mc.mcGetInstance ()
        if state == 1 then
            mc.mcAxisHomeAll (inst)
        end

112
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 03, 2015, 08:16:17 PM »
just delete it and write your own M3 macro, lol. haha. // you know you probably will anyways. hehe

113
Mach4 General Discussion / Re: need a little bit of help
« on: June 02, 2015, 11:10:38 PM »
...although "Lua uses double precision to represent numbers, your program can run for two hundred years, doing one million insertions per second, before it has problems with overflows." Is that fast enough to accomplish what the requirement is? Dependent on hardware of course   ;D

114
Mach4 General Discussion / Re: need a little bit of help
« on: June 02, 2015, 09:53:57 PM »
comments from the peanut gallery. me and my theory...motor counts and motion control. to go from (0,0,0) to (10,0,0) we just write G00 G90 X10.0. Lua see's this as just a string. Does the interpreter "interpret" this command  as rapid move, absolute position mode, "move positive 10 inches" or is the "move 10 inches" converted by a time/distance formula and this message is passed to the motion controller which relay's the info to the driver (or the motion controller does this and the core just provides the data for the motion controller to convert the X10.0 command via the motion cycle planner?) Wherein this message takes the given motors "counts" (encoder counts or step pulses) per inch  in relation to velocity/acceleration/backlash comp. etc...(maybe this is why the core wants a MSG_REPORT_MOTOR_STOP request in order to update the cycle planner, GUI data, and append any files) Unless we can somehow intercept each bit of that message or each individual motor count per move (as if the X10.0 message is broken down into 1,000,000 bits or something)  by the PLC to sync LUA and gCode I don't see it happening. Well, yes and no. I see it happening with proprietary software on proprietary machines. I don't see it happening at a reasonable and affordable price point that we get Mach4 for and then place the software on computers and machinery of our choice. The PLC would have to be like quadruple the speed at which the core and the motion controller are communicating plus coordinate lua commands and real time user commands. Idk, shoot. I'm just trying to hang with the big boys. I mean yes, you are right and yes they are right. I just learn how to use what's given to me.  What's the word I was taught...????Ah, yes, sensitive site exploitation. Well I'm not going to exploit Mach4 but sure as heck going to manipulate it (within the capabilities that are provided to me). I think I am going to see my way out of this conversation....and not get stuck in the middle.  :P I am just trying to learn.

115
Mach4 General Discussion / Re: need a little bit of help
« on: June 02, 2015, 08:16:44 PM »
Using the PLC flags as a means to control blocks, yes, this works wonderfully. But, as an example when I execute a function in the PLC ie. mc.mcJogVelocityStart / Stop, my probe will stop the motor and axis from moving (mapped to input 0 not G31) but, if I release a block of gCode ie. mc.mcCntlGcodeExecute, I have no effect over the execution of that line while the machine is running. My input commands to stop from what I have coded are ignored as well as any input signals until that line has finished. I must manually stop from the GUI.  Is this what you mean? I'm just trying to comprehend things in my head a little. It's like Block racing vs. block syncing.....am I close?

116
Mach4 General Discussion / Re: need a little bit of help
« on: June 02, 2015, 07:38:36 PM »
The PLC flags work! I totally understand this now. This is sweet. No more GUI lock ups, nor while/repeat loop lockups. I'm never going to sleep tonight. I got work to do! ...wait...is work supposed to be fun?


117
My computer just wanted to upload sample.mcs.  (with a period after the mcs extension, I'm sure it is something on my part) Thanx tho!

118
Mach4 General Discussion / Re: need a little bit of help
« on: June 02, 2015, 03:04:39 AM »
Thanx Steve! That is the theory I've been needing...another Sticky reply! I think you just unleashed Mach 4's potential right there...to everyone. Wow. It's going to take a minute or two to wrap my thinking cap around that but, yah...freakin awesome education right there.

--josh

119
Mach4 General Discussion / Re: Mach4 Executing Gcode from LUA
« on: June 02, 2015, 01:23:16 AM »
Hi Dan,

Are you good now? I feel like a di@I( head asking a question on top of yours. I got some things working pretty good if your're stuck. Hope all's well.

-josh

120
lmao, that was perfect!

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »