Hello Guest it is April 19, 2024, 05:59:20 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 - SwiftyJ

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 »
91
Mach4 General Discussion / Re: Homing A axis
« on: December 30, 2021, 07:39:11 AM »
Which motion controller are you using?

92
Mach4 General Discussion / Re: wx.MessageBox wait
« on: December 21, 2021, 06:27:46 AM »
You need to use a coroutine. Check out the Ref All button on the default Mach4 screens it uses one there.

This goes in your button script
wait = coroutine.create(testfunction)

Function goes in the screen load script - Note the coroutine.yield() after the Mdi execute
function testfunction()
     local inst = mc.mcGetInstance()
    mc.mcCntlMdiExecute(inst, "G0 X1")
    coroutine.yield()
    wx.wxMessageBox("Hello")
end

In the default mach screens there is some lua script in the PLC that will resume the couroutine called 'wait' if it is yielded and the Mach state is idle.  This code should already be in your screen...

93
Mach4 General Discussion / Re: G code to change rapid speeds
« on: December 16, 2021, 03:50:53 AM »
So you are saying you need to increase the max velocity in the Mach4 motor config. If this is the case then you would use

rc = mc.mcMotorSetMaxVel(number mInst,    number motorId, number maxVel)

But I do not know if this is possible during execution of g-code.

94
Mach4 General Discussion / Re: G code to change rapid speeds
« on: December 15, 2021, 05:43:30 AM »
You can use the following inside a custom macro to set the rapid speed as a percentage. You can pass a value to the macro from the gcode and set it. e.g. M103 V2000. To set it as mm/min you would just have to calculate the percentage of the max rapid speed.

I've just thrown this together... Not tested..

Code: [Select]
function m103(hParam)
local inst = mc.mcGetInstance();
local maxVel = 3000
if (hParam ~= nil) then

local vVal = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_V)
local vFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_V)

local RROpercent = (vVal/maxVel)*100

if(vFlag == 1) then
mc.mcCntlSetRRO(inst, RROpercent)
end
end
end

95
If you can read the MPG counts through a register you could monitor the register in the PLC script and when it changes if the inputs for spindle override or feed override are on then adjust. Maybe something like this..?

Get register count
if register count does not equal last count then
    if spindle override switch is on
          adjust spindle override
    end
    if feed override switch is on
          adjust feed override
    end
end
last register count = current register count

96
Mach4 General Discussion / Re: Stupid LUA question
« on: December 15, 2021, 03:08:50 AM »
You may be better off creating a global table of the handles rather than the input/output numbers. This way you will only need to call mcSignalGetState with the appropriate handle rather than getting the handle each time.


97
Mach4 General Discussion / Re: Clearpath Servo Feedback Displays
« on: November 30, 2021, 10:08:41 AM »

Is there a sliding-scale 0-100 screen widget?


Yes, it can be customised as you need with colours/segments/3D effect etc.  It is the 'gauge control' next to the MDI control in the screen editor

98
I believe you are correct in that this is a plugin issue. I think it has to report back to Mach that it has not probed anything and abort the probe sequence itself. I don't know how well they support their plugin for Mach4 as they obviously have their own CNC software.

99
Mach4 General Discussion / Re: Setting zero positions for G30
« on: November 17, 2021, 03:24:47 AM »
You don't really need to know the # variable number if you're programming these in lua as you can use enum e.g. mc.SV_G_30_P2_XPOS If you type the first part of this in ZeroBraneEditor then it will display the rest of them. (if you want to see this list easily go to: C:\Mach4Hobby\ZeroBraneStudio\api\lua and then open the mc.lua file in a text editor.)

If you do need to know the number for setting it via gcode then you can just add this enum to the watch window and look at it's value

100
Mach4 General Discussion / Re: Modbus sending same register twice
« on: November 14, 2021, 01:47:35 AM »
There is an MQTT library for lua, check out this thread https://www.machsupport.com/forum/index.php?topic=36807.0

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