Hello Guest it is April 27, 2024, 03:45:28 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
161
Mach4 Toolbox / Autoenable softLimitsOn() on startup.
« on: May 28, 2015, 03:43:08 AM »
1. Operator -> Edit Screen -> highlight wxMach on screen tree editor (top left side of screen) -> goto Properties (middle left side of screen) -> click events (lightning bolt) -> highlight Screen Load Script -> click on Ellipsis box to enter the mcLua editor

2. Create a global variable to count ie, myCounter = 0

--Start my code.

myAxisCount = 0

function myTotalEnabledAxis ()
    local mInst = 0
    local rc = 0
    local inst = mc.mcGetInstance (mInst)

    for i=0, 11 do
        if mc.mcAxisIsEnabled (inst,i) == 1 then
            myAxisCount = myAxisCount + 1
        end
    end
end
myTotalEnabledAxis ()

function setMySoftLimitsOn(myAxisCount)
    local mInst = 0
    local rc = 0
    local inst = mc.mcGetInstance (mInst)

    for i=0,myAxisCount do
        mc.mcSoftLimitSetState (inst,i,1)
    end
end
setMySoftLimitsOn(myAxisCount)

162
Got a theory (well, another avenue of approach)...stay tuned.

163
Second that...PMDX support is second to none and first class. It is not often that you just pick up the phone, call, and actually talk to the owner! Who, by the way will spend time with you on the phone and answer your questions until you feel comfortable in taking the next step.

--josh

164
mc.mcCntlCycleStart(inst)...not mc.mcCntrlCycleStat(inst), I know how some can be picky but woodfordReserve knows forgiveness!

165
I keep forgetting to set my soft limits to on! PITA when I crash. So, here is some little Lua code that you can add to the RefAllHome button to automatically set your soft limits to on. 1. Operator->Edit screen->highlight RefHomeAll button, 2. on the left middle side of your screen, click on the notepad with the lightning bolt, 3. highlight where you see the code starting and click on the three dots box (side note: left down action vs. left up action vs left down script vs. left up script vs. click script are actions that are in relation to your mouse whereas when you press your left mouse button down it can call a script you have written, or call a predefined action written by NFS that you can choose from the pop up menu, etc. and then when you release the mouse button the left up action/script can do another call; the clicked script only executes a written script once -thank you simpson36 for sharing!) Hope this may help someone.

function softLimitsOn ()
    local inst = mc.mcGetInstance()
    local rc = 0
    local i = 0
    local j = 0

    for i=0,11 do                                                 --because there are 12 axes that can be mapped
        local val, rc = mc.mcAxisIsEnabled(inst,i)     --find which axes are enabled
        if val == 1 then                                         --if they are enabled, then
            j=j+1                                                   --start a counter
        end
    end

    j=j-1                                                            -- j=j-1 because of the whole '0' is actually the first instance in an arrays/stack,etc.

    for i=0,j do                                                   -- for how many axes are enabled; set the softlimit state to on
        mc.mcSoftLimitSetState (inst, i, 1)               -- found that mcSoftLimitSetState is more reliable than mcAxisSoftLimitEnable call function;
    end
end
softLimitsOn()                                                   --[[ call your softLimitsOn function and execute, I found that if you put this code in screenLoadScript
                                                                            that it may cancel your jogging capabilities whereas they will become greyed out. But hey,
                                                                            you never know unless you try!--]]

--josh

166
Hi folks,

I'm Josh...new around here. I've read a lot on this forum, built a machine, immediately jumped from Mach3 to Mach4 and have been working Lua a bit. Currently, I have a signal library built in the screen load script to watch for ISIG_INPUT0 events that will stop the axis from moving (Gcode cycles and jogging) from the basic if statement in the signal script. This works. Because G31 is not supported by my hardware yet I am trying to find a work around with programming the AutoToolSet button. The issue I am having is that the signal library is not recognizing the mc.mcCntlGcode...calls to stop the axis from moving when I code in Lua the button scripts. I think that screen scripts are different than mCode scripts from an interpreter standpoint that load into a different stack/buffer?.?.?... Anywho, any recommendations on how to say the signal library can recognize a call to mc.mcCntlGcodeExecute(inst, "G01 X...Y...Z..F.../n") and recognize an input signal mapped to mc.ISIG_INPUT0  in the signal library to stop the axis? Also, for kicks, if I call mc.mcCntLoadlGcode or string or file, how do I get that to execute? mc.mcCntlEnabled(inst, 1), mc.mcCntrlCycleStat(inst) doesn't execute the string (I've also tried incorporating input/output handle/get/set state function calls in the algorithm). I think I am missing something easy here...I am just asking for some direction and I can take Mach4 for a ride :o) I pretty much memorized the calls get/set/do from the down and dirty Lua pdf, scripting manual, pound variable list, signals list, the Spaced Out Lua reference (that was awesome!), Mach4 API, Lua Calls, etc. (yep, there is a reason why I am divorced :o) I can't remember "her" birthday but sure as ********* can remember programming function calls! Hope to hear from y'all and promise to share any code that may be relevant to new users coming from Mach3. After all, Mach 4 Hobby users are the beta testers for NFS. Great business strategy btw...crowd source beta testing...at a little cost. But, I've learned so much that it's okay with me and am glad to become apart of the community. Now...if I can cut my first part before I am 100 yrs. old...reliability, repeatability, and accuracy; it is computer numerical control for a reason, lol. Yes, I've learned Gcode sequences too, but the beauty of Mach4 is combining Lua and Gcode to execute a block. The potential capabilities are pretty darn good. I just need a strip map to let screen calls and mCode macro calls communicate with global function / reference tables and the signal script. My two cent...ok, may three cents...

-josh

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