Hello Guest it is May 08, 2024, 12:07:41 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 - smurph

1031
Galil / Re: DMC-4080 Mill Retrofit
« on: May 27, 2014, 04:10:43 PM »
Yes, wire them to the Galil. 

Steve

1032
Mach4 General Discussion / Re: MACH4 Mcode testing
« on: May 27, 2014, 01:27:10 AM »
Hmm...  mine works every time.  I also have G code that uses Macro B that does a nice job of serial numbers.

Steve

1033
Mach4 General Discussion / Re: Mach 4 Bug Reports
« on: May 27, 2014, 01:09:51 AM »
Scott,

It runs fine here.  Load script, hit F5, and I end up at a auto generated break point.  Then I can F10 (step) or F11 (step into) as needed.  I can also hit F5 (continue) and the scripts finishes with a message "Debug session finished."

XP perhaps?  I have not visited the XP VM in a while...

Steve

1034
Mach4 General Discussion / Re: Screen Set Ideas
« on: May 26, 2014, 11:24:39 PM »
I found and fixed over 15 of them!  All bad bindings.

Steve

1035
Mach4 General Discussion / Re: MACH4 Mcode testing
« on: May 26, 2014, 07:18:26 PM »
A better example.  m100 will not execute at all from MDI or G code file.  Because user M codes start at 101.  It will run in the editor though.  So I changed it to M101 and it works fine.

Code: [Select]
function m101()
    local inst = mc.mcGetInstance();
    mc.mcCntlSetLastError(inst, "m101");
    local SNv = mc.mcCntlGetPoundVar(inst , 590);
    local str = string.sub(SNv, 1, 6);
    local idx = 0;
    mc.mcCntlSetLastError(inst, "#590 = " .. str);
    --local SN = {}
    local SN;
    for idx = 1, #str do
        SN = str:sub(idx, idx);
        if     SN == "1" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X1.0");
        elseif SN == "2" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X2.0");
        elseif SN == "3" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X3.0");
        elseif SN == "4" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X4.0");
        elseif SN == "5" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X5.0");
        elseif SN == "6" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X6.0");
        elseif SN == "7" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X7.0");
        elseif SN == "8" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X8.0");
        elseif SN == "9" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X9.0");
        elseif SN == "0" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X0.0");
        end
    end
    mc.mcCntlSetLastError(inst, "Setting #590 = " .. tostring(SNv + 1));
    mc.mcCntlSetPoundVar(inst , 590, SNv + 1);
end

if (mc.mcInEditor() == 1) then
    m101()
end

1036
Mach4 General Discussion / Re: MACH4 Mcode testing
« on: May 26, 2014, 06:30:16 PM »
For your first example, I don't know what you were doing with that table.  I assume that you wanted to walk the digits of the #590 var.  This is more easily accomplished by converting the #var number to a string.  This is done by the "string.sub(SNv, 1, 6);".  Then just loop through each character.

Code: [Select]
function m100()
    local inst = mc.mcGetInstance();
    local SNv = mc.mcCntlGetPoundVar(inst , 590);
    local str = string.sub(SNv, 1, 6);
    local idx = 0;
    --wx.wxMessageBox(tostring(str));
    --local SN = {}
    local SN;
    for idx = 1, #str do
        SN = str:sub(idx, idx);
        if     SN == "1" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X1.0");
        elseif SN == "2" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X2.0");
        elseif SN == "3" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X3.0");
        elseif SN == "4" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X4.0");
        elseif SN == "5" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X5.0");
        elseif SN == "6" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X6.0");
        elseif SN == "7" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X7.0");
        elseif SN == "8" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X8.0");
        elseif SN == "9" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X9.0");
        elseif SN == "0" then
                mc.mcCntlGcodeExecuteWait(inst, "G0 X0.0");
        end
    end

    mc.mcCntlSetPoundVar(inst , 590, tonumber(str) + 1);
 
end

if (mc.mcInEditor() == 1) then
    m100()
end

1037
Mach4 General Discussion / Re: MACH4 Mcode testing
« on: May 26, 2014, 02:28:53 PM »
Did you forget to post the script?  Or are you talking about the one above?

1038
Mach4 General Discussion / Re: MACH4 Mcode testing
« on: May 26, 2014, 02:40:44 AM »
Try combining the two Gcode executes.  Like:

mc.mcCntlGcodeExecute(inst, "G0X10\nG0X0");

I wasn't looking too closely at your original script and I didn't catch that.  If you'll take a look at the m6 macro, you'll see where we did the same sort of thing that combines a lot of lines of G code into one call to mc.mcCntlGcodeExecute().

The technical reason is that each call to mc.mcCntlGcodeExecute() fires up it's own interpreter.  It is not like feeding a new line to the same interpreter.  It executes the code as a unit of work.  If you want the script to wait on the G code to complete before moving on, call mc.mcCntlGcodeExecuteWait() instead.

Steve

1039
Mach4 General Discussion / Re: MACH4 Mcode testing
« on: May 25, 2014, 11:53:49 PM »
Did you name the file m100.mcs?   Go look at m3.mcs.  It is NAMED m3.mcs, there is a function NAMED m3.mcs, and then there is a piece of code at the bottom of the script that tests to see if it is being run from the editor.  If it is running in the editor, if calls the m3() function inside that if block.

In a file called m100.mcs, put:
Code: [Select]
function m100()
    inst=mc.mcGetInstance();
    mc.mcCntlSetLastError(inst, 'Serial Number Engrave')
    mc.mcCntlGcodeExecute(inst, "G0X10 ");
    mc.mcCntlGcodeExecute(inst, "G0X0 ");
end

if (mc.mcInEditor() == 1) then
    m100()
end

It is like that for a reason.  It has to be that way where the scripts run in compiled mode as part of a larger "chunk" in Mach 4 and it also enables you to run the "snippet" inside the editor to debug it.

Steve

1040
Mach4 General Discussion / Re: Screen Set Ideas
« on: May 25, 2014, 09:11:53 PM »
mc.mcToolPathGetBackColor() has a bad binding.  Thanks for finding that Scott!  It will be in the next update.

Steve