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

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



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?


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)

co = coroutine.create (demoprobe)

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);

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

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

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")

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

    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)

return probing

Pages: 1