Hello Guest it is May 15, 2021, 01:30: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.


Topics - McClean

Pages: 1
1
Hi,

im currently trying to control Mach3 via COM-Interface from a c# application. This works fine but i have a problem.

I need to access elapsed / estimated time (14/15) via GetDRO. The result is always 0. I tried to use GetDROString - but the result is 0.000 too.
Is this a bug in the GetDRO function? What can i do to access this values?

Im using latest Mach3 version

Thanks,
Steffen

2
Hi,

im testing mach4 and at the moment i implement probing functions. My problem is that script is ending unexpected

Probing starts but the script stops running after this step. "probing.enableTrigger(false)" is never called.
I checked the script without coroutine and this works but freezing the ui

Can someone help me?

Thanks,
Steffen





Here is the button code:
Code: [Select]
local inst = mc.mcGetInstance()
local profile = mc.mcProfileGetName(inst)
local path = mc.mcCntlGetMachDir(inst)

package.path = path .. "\\Modules\\?.lua;" .. path .. "\\Profiles\\" .. profile .. "\\Modules\\?.lua;"

--Probing module
package.loaded.ProbingModule = nil
probing = require("sthProbing")

function demoprobe()
    probing.do_probing(-5, 25, 5)
end

co = coroutine.create (demoprobe)
coroutine.resume(co)

sthProbing.lua code
Code: [Select]
local probing = {}

probing.AXIS_X = "X"
probing.AXIS_Y = "Y"
probing.AXIS_Z = "Z"


function probing.enableTrigger(enable)
local inst = mc.mcGetInstance()
local digitrigger= mc.mcSignalGetHandle(inst, mc.OSIG_DIGTRIGGER)
mc.mcSignalSetState(digitrigger, enable);
end


function probing.isProbeActive()
local inst = mc.mcGetInstance()
    local probsig = mc.mcSignalGetHandle(inst, mc.ISIG_PROBE)
    return mc.mcSignalGetState(probsig) == 1
end


function Code(Gcode)
    local inst = mc.mcGetInstance()
rc = mc.mcCntlGcodeExecute(inst, Gcode)
coroutine.yield(rc)
end

function probing.do_probing(maxoffset, speed, safez)
    local inst = mc.mcGetInstance()
    ------ Get current state ------
    local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)
    local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)
    local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)

    if probing.isProbeActive() then
        mc.mcCntlSetLastError(inst, "ERROR: Probe is already triggered")
        return
    end

    probing.enableTrigger(true)
    --mc.mcCntlGcodeExecuteWait(inst, "G01 G91 G21 G31 Z" .. maxoffset .. " F" .. speed)
    Code("G01 G91 G21 G31 Z" .. maxoffset .. " F" .. speed)
    probing.enableTrigger(false)


    local zProbeStrikePos = mc.mcCntlGetPoundVar(inst, 5063)
    local zAxisCurrentPos = mc.mcAxisGetPos(inst, 2)
    local zGoPos = zProbeStrikePos + safez

    mc.mcCntlSetLastError(inst, "Probe: " .. zProbeStrikePos)
    mc.mcCntlSetLastError(inst, "Probe2: " .. zAxisCurrentPos)
    mc.mcCntlSetLastError(inst, "Go: " .. zGoPos)


    mc.mcCntlGcodeExecuteWait(inst, "G0 G91 G21 Z" .. safez)
    mc.mcAxisSetPos(inst, 2, 0)

    ------ Reset state ------
    mc.mcCntlSetPoundVar(inst, 2134, CurFeed)
    mc.mcCntlSetPoundVar(inst, 4001, CurFeedMode)
    mc.mcCntlSetPoundVar(inst, 4003, CurAbsMode)
end

return probing


Pages: 1