Hello Guest it is April 26, 2024, 08:28:43 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 - soruud

Pages: « 1 2 3
21
Mach4 General Discussion / Re: USB gamepad as jogging device
« on: May 28, 2017, 04:02:19 AM »
So Captain sq... You live in sweeden :) Where in sweeden may I ask? I live in Norway myself. 1 hour cartrip from Charlottenberg.

 Using Pokeys57U for a control panel isnt a bad idea. I am doing the same, and allso got 6 PoextBus Output boards connected to it,
 so I get Additionally 48 Outputs to manage LED's in by buttons. The PoextBus dont steal any I/O's, so with 48 Outputs I still got 55 Inputs to use for MPG Handwheel and buttons. It allso
has 7 analog inputs , and I belive they can be used for analog joystic of own choise to use for jogging. I will try to set up analog jog on a board tonight.
BTW... Check my Youtube channel for some videos of my CNC Control panel build.. More videos are comming soon...  ;D
https://www.youtube.com/user/StigOveRuud/videos



22
Mach4 General Discussion / Re: Need some minor LUA adjustments...
« on: May 26, 2017, 06:39:28 AM »
Hi Craig. Thanx for your reply.
As time has past and no one had a awnser I had to try myself. And I got it to work :)
Take a look at the LUA below. I only got the X,Y,Z axis active for now.
I allso added a line ( scr.SetProperty('mpgaxisdisplay', 'Label', 'X axis'); under each Axis selection to post on screen what axis are currently active.
To display the current Axis just make an Toggle button in screen edit, and name it "mpgaxisdisplay" This name can be what you desire, but MUST be the same as in the
( scr.SetProperty('mpgaxisdisplay', 'Label', 'X axis'); line. The name is allso Case Sensitive !!!. And ofcourse you will need to change the X letter with Y, Z,A.. and so on in this line to show correct axis.
Actually this line can be used to display anything you want at anny time :)
The momentary buttons on my Control Panel are connected to a POKEYS57U board, and can easly be mapped to your desired Signal Inputs in MACH Config.
In my case as you see in the script I use Input 50, 51 and 52 for my X Y and Z axis.
Thats it. Now Axis selection will work with momentary buttons, and the current axis will be displayed on screen.



--------------------------------------
--       CNC4PC Pendant             --
--------------------------------------
-- These simply run the CNC4PCPendant function if their state changes.
[mc.ISIG_INPUT50] = function (state)    CNC4PCPendant() end,
[mc.ISIG_INPUT51] = function (state)    CNC4PCPendant() end,
[mc.ISIG_INPUT52] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT13] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT14] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT15] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT16] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT17] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT18] = function (state)    CNC4PCPendant() end,
--[mc.ISIG_INPUT19] = function (state)    CNC4PCPendant() end,
}
-------------------------------------------------------------
-- CNC4PC Pendant function. --
-------------------------------------------------------------
function CNC4PCPendant()
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT50)    -- Is mapped to Pokeys pin50 *X Selection
local XSelection, rc = mc.mcSignalGetState(hSig)
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT51)    -- Is mapped to Pokeys pin51 *Y Selection
local YSelection, rc = mc.mcSignalGetState(hSig)
local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT52)    -- Is mapped to Pokeys pin52 *Z Selection
local ZSelection, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT13)    -- Is mapped to Port 2 Pin 7 *A Selection
--local ASelection, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT14)    -- Is mapped to Port 2 Pin 8 *.001 Selection
--local Step001, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT15)    -- Is mapped to Port 2 Pin 9 *.010 Selection
--local Step010, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT16)    -- Is mapped to Port 2 Pin 10 *.100 Selection
--local Step100, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT17)    -- Is mapped to Port 2 Pin 15 *Estop
--local PenStop, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT18)    -- Is mapped to Port 2 Pin 12 *B Selection
--local BSelection, rc = mc.mcSignalGetState(hSig)
--local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT19)    -- Is mapped to Port 2 Pin 13 *C Selection
--local CSelection, rc = mc.mcSignalGetState(hSig)
local PenJogOn, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT10)-- Is mapped to Port 2 Pin 1 *Jog on LED

if XSelection == 1 then
    mc.mcMpgSetAxis(inst, 0, 0) --X Axis
    mc.mcCntlSetLastError(inst, "X Selected")
    mc.mcSignalSetState(PenJogOn, 1)
    scr.SetProperty('mpgaxisdisplay', 'Label', 'X axis');

elseif YSelection == 1 then
    mc.mcMpgSetAxis(inst, 0, 1) --Y Axis
    mc.mcCntlSetLastError(inst, "Y Selected")
    mc.mcSignalSetState(PenJogOn, 1)
    scr.SetProperty('mpgaxisdisplay', 'Label', 'Y axis');

elseif ZSelection == 1 then
    mc.mcMpgSetAxis(inst, 0, 2) --Z Axis
    mc.mcCntlSetLastError(inst, "Z Selected")
    mc.mcSignalSetState(PenJogOn, 1)
    scr.SetProperty('mpgaxisdisplay', 'Label', 'Z axis');

--elseif ASelection == 1 then
--    mc.mcMpgSetAxis(inst, 0, 3) --A Axis
--    mc.mcCntlSetLastError(inst, "A Selected")
--    mc.mcSignalSetState(PenJogOn, 1)  

--elseif BSelection == 1 then
--    mc.mcMpgSetAxis(inst, 0, 4) --B Axis
--    mc.mcCntlSetLastError(inst, "B Selected")
--    mc.mcSignalSetState(PenJogOn, 1)

--elseif CSelection == 1 then
--    mc.mcMpgSetAxis(inst, 0, 5) --C Axis
--    mc.mcCntlSetLastError(inst, "C Selected")
--    mc.mcSignalSetState(PenJogOn, 1)

--else mc.mcMpgSetAxis(inst, 0, -1) --No Axis
--    mc.mcCntlSetLastError(inst, "No Axis Selected")
--    mc.mcSignalSetState(PenJogOn, 0)

 end

    if Step001 == 1 then
        mc.mcMpgSetInc(inst, 0, .001)
    elseif Step010 == 1 then
        mc.mcMpgSetInc(inst, 0, .010)
    elseif Step100 == 1 then
        mc.mcMpgSetInc(inst, 0, .100)
    end

--if PenStop == 1 then mc.mcCntlEStop(inst) end
end


To make it work with momentary buttons I had to disable the:

--else mc.mcMpgSetAxis(inst, 0, -1) --No Axis
--    mc.mcCntlSetLastError(inst, "No Axis Selected")
--    mc.mcSignalSetState(PenJogOn, 0)

23
Is there no one that can help me here ?
I found out how to display what offset curently in use.. But how can I have a display that tells me what Distance Mode I am currently in? G90 or G91... ???
Yes.. I know about the Modal code line.. Just want it a bit more easy to see another place on screen...


24
Hi. I need to know how to make an DRO to show what is my current CS It can allso be LED's with label G54, G55..
I would allso like to set G90 or G91 with buttons on screen. Cant find out how to do this...


Thanx  :)

25
Mach4 Videos / Re: Mach4 Quicky #6 - Disable Keyboard Plugin
« on: May 20, 2017, 08:14:58 AM »
Did you find a way to deactivate keyboard when Mach4 lost focus to?
Keyboard jogging outside Mach4 program is a bit scary  :o

Could mcGuiSetFocus be used? in that case, how?   I looked around for something like WindowLostFocus() but didnt find anything.
I am a bit supprised that Mach didnt fix this as it can be a bit dangerous...


26
Mach4 Toolbox / Jog Inc with keyboard or external buttons
« on: May 19, 2017, 12:30:30 PM »
Hi. When Jog mode are set to Incremental, jog-buttons on screen works as inc.step as it should  :). But keyboard buttons keep go Continous... Is that normal ???
If I map hardware buttons to Jog functions in Mach Input / Signals (ex: Jog X+) the jogging will work but continues after I release the button. I got to push again to stop jogging, and the same happens even in Incremental mode.
How can I map my hardware Jog buttons to make it work just like the buttons on screen? even in Incremental mode...
This should be pretty easy to fix I guess.. IF you know what to do... I dont.. :(
I know there is plenty og ppls in this forum with tons of knowledge... Still no awnsers to most questions asked here... How come?

27
Mach4 Toolbox / Re: Mapping screen button to pokeys ExtBus pin
« on: May 17, 2017, 01:05:11 PM »
Hi. Yes I know it can be done that way. The thing is that Mach only got 64 signal inputs and 64 outputs. I need a lot more to cover my needs on my control panel.
Therfore I was hoping to adress Pokeys I/O's directly not using Mach signals. At least for some of my buttons.
I dont know much about LUA, so this is pretty hard to do... I just have to copy and paste from scripts I find online and hope for the best.

I did read that PDF :)

28
Mach4 Toolbox / Mapping screen button to pokeys ExtBus pin
« on: May 16, 2017, 04:54:16 PM »
Hi. What is wrong with this script below?
I wrote this as a down script on an button in screen editor to trigger an output on my Pokeys56U ExtBus board.
I dont get any errors, but it wont work either...

Do I NEED to assign all inputs and outputs to signals in MACH edit? Or is it possible to adress directly as I tried here?

------------------------------------------
function testing()
local inst= mc.mcGetInstance();
local out4= mc.mcSignalGetHandle(inst, ("PoKeys_30346 PoExtBus/PoExtBus 01.2"));
mc.mcSignalSetState(out4, true);
end

29
Mach4 General Discussion / Need some minor LUA adjustments...
« on: May 15, 2017, 03:15:41 PM »
Hi. I got a LUA script for an Pedant, but I need help to adjust it a bit for my needs.
This Lua is written for pedant with 2 selector knobs to set MPG Axis selection and STEP rate.
I will use momentary pushbuttons for this if possible. So I will use 4 buttons for X Y Z A axis, and 3 buttons for STEP rate 0.1 - 0.01 and 0.001.
Can someone please help me?  I should mention that I dont know much about LUA... ???


--Go to the closing } of the SigLib table in the screen load script and
--delete it. Then paste all of this code in its place.
--The new closing } for the SigLib table is on line 48 of this script.
--------------------------------------
--          CNC4PC Pendant         --
--------------------------------------
-- These simply run the CNC4PCPendant function if their state changes.
[mc.ISIG_INPUT10] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT11] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT12] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT13] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT14] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT15] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT16] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT17] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT18] = function (state)
    CNC4PCPendant()
end,

[mc.ISIG_INPUT19] = function (state)
    CNC4PCPendant()
end

}

---------------------------------------------------------------
-- CNC4PC Pendant function.
---------------------------------------------------------------
function CNC4PCPendant()
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT10)    -- Is mapped to Port 2 Pin 4 *X Selection
   local XSelection, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT11)    -- Is mapped to Port 2 Pin 5 *Y Selection
   local YSelection, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT12)    -- Is mapped to Port 2 Pin 6 *Z Selection
   local ZSelection, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT13)    -- Is mapped to Port 2 Pin 7 *A Selection
   local ASelection, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT14)    -- Is mapped to Port 2 Pin 8 *.001 Selection
   local Step001, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT15)    -- Is mapped to Port 2 Pin 9 *.010 Selection
   local Step010, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT16)    -- Is mapped to Port 2 Pin 10 *.100 Selection
   local Step100, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT17)    -- Is mapped to Port 2 Pin 15 *Estop
   local PenStop, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT18)    -- Is mapped to Port 2 Pin 12 *B Selection
   local BSelection, rc = mc.mcSignalGetState(hSig)
   local hSig, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT19)    -- Is mapped to Port 2 Pin 13 *C Selection
   local CSelection, rc = mc.mcSignalGetState(hSig)
   local PenJogOn, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT10)-- Is mapped to Port 2 Pin 1 *Jog on LED
   
   if XSelection == 1 then
      mc.mcMpgSetAxis(inst, 0, 0) --X Axis
      mc.mcCntlSetLastError(inst, "X Selected")
      mc.mcSignalSetState(PenJogOn, 1)
   elseif YSelection == 1 then
      mc.mcMpgSetAxis(inst, 0, 1) --Y Axis
      mc.mcCntlSetLastError(inst, "Y Selected")
      mc.mcSignalSetState(PenJogOn, 1)
   elseif ZSelection == 1 then
      mc.mcMpgSetAxis(inst, 0, 2) --Z Axis
      mc.mcCntlSetLastError(inst, "Z Selected")
      mc.mcSignalSetState(PenJogOn, 1)
   elseif ASelection == 1 then
      mc.mcMpgSetAxis(inst, 0, 3) --A Axis
      mc.mcCntlSetLastError(inst, "A Selected")
      mc.mcSignalSetState(PenJogOn, 1)
   elseif BSelection == 1 then
      mc.mcMpgSetAxis(inst, 0, 4) --B Axis
      mc.mcCntlSetLastError(inst, "B Selected")
      mc.mcSignalSetState(PenJogOn, 1)
   elseif CSelection == 1 then
      mc.mcMpgSetAxis(inst, 0, 5) --C Axis
      mc.mcCntlSetLastError(inst, "C Selected")
      mc.mcSignalSetState(PenJogOn, 1)
   else
      mc.mcMpgSetAxis(inst, 0, -1) --No Axis
      mc.mcCntlSetLastError(inst, "No Axis Selected")
      mc.mcSignalSetState(PenJogOn, 0)
   end
   
   if Step001 == 1 then
      mc.mcMpgSetInc(inst, 0, .001)
   elseif Step010 == 1 then
      mc.mcMpgSetInc(inst, 0, .010)
   elseif Step100 == 1 then
      mc.mcMpgSetInc(inst, 0, .100)
   end
   
   if PenStop == 1 then
      mc.mcCntlEStop(inst)
   end
end

Pages: « 1 2 3