Hello Guest it is June 04, 2024, 06:05:55 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 - rae_gordon

Pages: « 1 2 3 4 »
11
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 04:52:51 PM »
Thanks Bob I just subscribed.

12
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 04:50:36 PM »
Fixed and working.  I did update to the newest everything, PMDX and Mach4.  BOB, I could no longer duplicate the Underrun so that is solved.  I tested it fully for all scenarios and it works great as it.  I do have one concern which may be an issue.  I hope Daz can give me input on this.  Basically when I probe, it zeros the Z axis and rewrites the fixture table, I believe that I need to add code to toggle the height offset on, otherwise it writes to the fixture table without it on, then when activated by running program it will no longer have the table as Z.  That was why I was originally writing to the tool table with my previous version.

Do I
1)  "toggle the height offset G49" in M6 or
2)  "write the offsets into the "Work shift",  G92, or somewhere else.  or
3)  go back and write the measured tool lengths into the tool table as I originally started doing


Code: [Select]
function M6() -- this code is based on a CNC Router table where zero is always the machine top.
    local inst = mc.mcGetInstance();
    local selectedtool = mc.mcToolGetSelected(inst)
    local currenttool = mc.mcToolGetCurrent(inst)
    local hsig = mc.mcSignalGetHandle(inst, mc.ISIG_PROBE)
    local changetoo = mc.mcToolGetDesc(inst,selectedtool)
    local toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool)
   --your machine info custom to you
    local touchplate = 0 -- this is the height above or below table surface for non flush touchplates.
    local longesttool = 6 -- this is the longest bit that you own that you could possibly use
    local zclearance = -11.375 -- this is the measurment from your collet to machine top "Zero"
    local probeclearance = .25 -- this is safe distance above touchplate where you want probe to start
   -- end of your machine info
    local undefinedtoolprobe = (zclearance + longesttool +touchplate + probeclearance )
    local undefinedprobetravel = (zclearance + longesttool + touchplate)
    local probestart = (zclearance + toollen + probeclearance +touchplate)

    if selectedtool == currenttool then
        mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required") 
    else
        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0") --move z axis all the way up
        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X0.464 Y-99.808") -- Move XY to above fixed touchplate location
        wx.wxMessageBox("Please change to tool "..selectedtool.." which is a "..changetoo.."")
        if toollen ~= 0 then   -- if toollen is defined in tool table do this
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
            ProbeState = mc.mcSignalGetState(hsig)
                if ProbeState == 0 then -- if probe is not sensed this prevents a false zero from being utilized.
                    repeat
                        mc.mcCntlSetLastError(inst, "ERROR: Touch Probe was not detected")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                        wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
                        ProbeState = mc.mcSignalGetState(hsig)
                    until(ProbeState == 1)
                    mc.mcAxisSetPos(inst, 2, (0 - touchplate))
                    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                    mc.mcCntlSetLastError(inst, "ToolChange Finished")
                    mc.mcToolSetCurrent(inst, selectedtool)
                else
            mc.mcAxisSetPos(inst, 2, (0 - touchplate))
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
            mc.mcCntlSetLastError(inst, "ToolChange Finished")
            mc.mcToolSetCurrent(inst, selectedtool)
                end
        else
            wx.wxMessageBox("Undefined tool proceed with caution")
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..undefinedtoolprobe.."\n G91 G31 Z"..undefinedprobetravel.." F8")
            ProbeState = mc.mcSignalGetState(hsig)
                if ProbeState == 0 then -- if probe is not sensed this prevents a false zero from being utilized.
                    repeat
                        mc.mcCntlSetLastError(inst, "ERROR: Touch Probe was not detected")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                        wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..undefinedtoolprobe.."\n G91 G31 Z"..undefinedprobetravel.." F8")
                        ProbeState = mc.mcSignalGetState(hsig)
                    until(ProbeState == 1)
                    mc.mcAxisSetPos(inst, 2, (0 - touchplate))
                    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                    mc.mcCntlSetLastError(inst, "ToolChange Finished")
                    mc.mcToolSetCurrent(inst, selectedtool)
                else
                mc.mcAxisSetPos(inst, 2, (0 - touchplate))
                mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                mc.mcCntlSetLastError(inst, "ToolChange Finished")
                mc.mcToolSetCurrent(inst, selectedtool)
                end
        end
    end

end

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

13
Mach4 General Discussion / Re: Mach 4 V2 Windows 10
« on: September 16, 2016, 01:55:42 PM »
FYI I have been running my machine on a dell inspiron 20, model 3043, TouchScreen all in one PC for quite a while.  I just put it in Airplane mode to keep updates and whatever from having access and it has worked for me. For a couple months I was running it full time

It is Windows 10 Home and I have not had a need to upgrade it yet.

I am using a PMDX 422.

For a qualifier, Today I am upgrading everything, doing all updates, so who knows it may not work again after today :)

14
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 01:23:31 PM »
BOB,
  I noticed that one of the revisions fixed underruns for short jog moves.  That may be related.

15
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 01:22:00 PM »
FYI,
  I was running
Mach build 2872
PMDX
 .36.171

I am going to upgrade it all to the latest.

16
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 12:20:42 PM »
Bob,
  I changed my code completely but I will do the same tests with this code.  Also I know I am running an older version of firmware and will get you that information after lunch.

If I remember correctly I did get the underrun and could jog, but since my probe state was not qualified it was stuck in the M6 command because it was never finished.  At least that is what I remember.

I rebooted my computer and low and behold it is doing windows updates, so will get more info after lunch.

17
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 12:06:59 PM »
Ok, this is my newest version, It looks good and allows me to call a non defined bit and still auto zero.  may take a while for the bit to there based on the longest bit you enter.  Will try it on my machine


Code: [Select]
function M6() -- this code is based on a CNC Router table where zero is always the machine top.
    local inst = mc.mcGetInstance();
    local selectedtool = mc.mcToolGetSelected(inst)
    local currenttool = mc.mcToolGetCurrent(inst)
    local hsig = mc.mcSignalGetHandle(inst, mc.ISIG_PROBE)
    local changetoo = mc.mcToolGetDesc(inst,selectedtool)
    local toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool)
   --your machine info custom to you
    local touchplate = 0 -- this is the height above or below table surface for non flush touchplates.
    local longesttool = 6 -- this is the longest bit that you own that you could possibly use
    local zclearance = -11.375 -- this is the measurment from your collet to machine top "Zero"
    local probeclearance = .25 -- this is safe distance above touchplate where you want probe to start
   -- end of your machine info
    local undefinedtoolprobe = (zclearance + longesttool +touchplate + probeclearance )
    local undefinedprobetravel = (zclearance + longesttool + touchplate)
    local probestart = (zclearance + toollen + probeclearance +touchplate)

    if selectedtool == currenttool then
        mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required") 
    else
        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0") --move z axis all the way up
        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X0.464 Y-99.808") -- Move XY to above fixed touchplate location
        wx.wxMessageBox("Please change to tool "..selectedtool.." which is a "..changetoo.."")
        if toollen ~= 0 then   -- if toollen is defined in tool table do this
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
            ProbeState = mc.mcSignalGetState(hsig)
                if ProbeState == 0 then -- if probe is not sensed this prevents a false zero from being utilized.
                    repeat
                        mc.mcCntlSetLastError(inst, "ERROR: Touch Probe was not detected")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                        wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
                        ProbeState = mc.mcSignalGetState(hsig)
                    until(ProbeState == 1)
                    mc.mcAxissetPos(inst, 2, (0 - touchplate))
                    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                    mc.mcCntlSetLastError(inst, "ToolChange Finished")
                    mc.mcToolSetCurrent(inst, selectedtool)
                else
            mc.mcAxisSetPos(inst, 2, (0 - touchplate))
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
            mc.mcCntlSetLastError(inst, "ToolChange Finished")
            mc.mcToolSetCurrent(inst, selectedtool)
                end
        else
            wx.wxMessageBox("Undefined tool proceed with caution")
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..undefinedtoolprobe.."\n G91 G31 Z-"..undefinedprobetravel.." F8")
            ProbeState = mc.mcSignalGetState(hsig)
                if ProbeState == 0 then -- if probe is not sensed this prevents a false zero from being utilized.
                    repeat
                        mc.mcCntlSetLastError(inst, "ERROR: Touch Probe was not detected")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                        wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..undefinedtoolprobe.."\n G91 G31 Z-"..undefinedprobetravel.." F8")
                        ProbeState = mc.mcSignalGetState(hsig)
                    until(ProbeState == 1)
                    mc.mcAxissetPos(inst, 2, (0 - touchplate))
                    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                    mc.mcCntlSetLastError(inst, "ToolChange Finished")
                    mc.mcToolSetCurrent(inst, selectedtool)
                else
                mc.mcAxissetPos(inst, 2, (0 - touchplate))
                mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                mc.mcCntlSetLastError(inst, "ToolChange Finished")
                mc.mcToolSetCurrent(inst, selectedtool)
                end
        end
    end

end

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


18
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 09:33:41 AM »
Gaz,
  Thanks for the Code, my first impression is that there is no reason for me to write to the tool file every time which is what I was doing.  I will rewrite and post my results though I am still going to keep it complicated.

19
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 16, 2016, 09:28:31 AM »
Quote
Your fixture offset may be getting clobbered because of this call:

            mc.mcAxisSetPos(inst, 2, toolz)

Bob, I don't believe this to be an issue since I have not finished this portion of the code and have yet to run an instance where this portion is utilized.  Saying that, I don't  know if there would be any adverse effects to it just being in there. 

This sounds like the there may be an issue in the SmartBOB with *very* short moves during probing.  I'll have to try that here.  When you run the M6 the 2nd time, is the tool still in contact with the touch plate?  Or has it backed off a little bit?  A lot?

If you do get the "motion underrun" error, you *should* be able to click on the Mach4 "Enable" button and continue running the machine (like, say, jogging the Z axis away from the touch plate).  Does that not work for you?  If you click on the "History" button in the lower left of the Mach4 screen, do you see any other messages?
[/quote]

after each probe instance, the Z goes all the way back up to the top zero location.  I believe the underrun only occurs when this line is initiated and I am already in this location.  If it has to jog to get here the underrun does not occur.  At least that is what I believe.  I am curious if you would get an underrun if you initiate a move to say 0,0,0 while at 0,0,0?

[/quote]
 mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0") --move z axis all the way up
 mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X0.464 Y-99.808") -- Move XY to above fixed touchplate location
[/quote]


20
Mach4 General Discussion / Re: Altering M6 but am confused
« on: September 15, 2016, 04:39:52 PM »
OK, this is what I have so far and I am stuck again.

  The main concept works, but there are still issues that I need help with.  I may need to reinstall because I now run into the issue where my Fixture offset for Z gets deleted when restarted.  This may not be the correct way, but the Z offset is the distance from my table to the router collet,  its the only way I could get the math to work the tool table bit length.  if there is a correct way, please let me know.  For reference, my Z height offset is set at -11.375

Problems
1) Initial M6 works because the machine has to move, if I do another m6 without first jogging the machine, I get an PMDX underrun error and have to restart the software.  If I jog the machine away so it has to move between M6 commands it does what it is supposed to, to the extent I have tested it.  Worst case I can check the location and skip the movements, but it doesnt seem correct to me.

2) If an z offset is enabled such a the bit or fixture while the m6 command is active it uses this value for the probe value and thus records the wrong bit length. I have not tried it with a program yet to see if that is going to occur, but I would like to find a way to prevent it in the event.  I figured I could check the state, if it is enabled, turn if off, then turn it back on, but there may be an easier way.

Code: [Select]
function M6()
    local inst = mc.mcGetInstance();
    local selectedtool = mc.mcToolGetSelected(inst)
    local currenttool = mc.mcToolGetCurrent(inst)
    local hsig = mc.mcSignalGetHandle(inst, mc.ISIG_PROBE)

  [color=blue] -- local currentheightoffset = mc.mcCntlGetOffset (inst , 2) basis for controlling event that tool offset is active
        --local HOState = mc.mcCntlGetPoundVar(inst, 4008)
        --if (HOState == 49) then
        --mc.mcCntlMdiExecute(inst, "G43")
        --else
        --mc.mcCntlMdiExecute(inst, "G49")
        --end[/color]

    if selectedtool == currenttool then
        mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required")
     
    else
        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0") --move z axis all the way up
        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X0.464 Y-99.808") -- Move XY to above fixed touchplate location
        local changetoo = mc.mcToolGetDesc(inst,selectedtool)

        wx.wxMessageBox("Please change to tool "..selectedtool.." which is a "..changetoo.."")
        toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool)
        if toollen ~= 0 then
            local probestart = (-11 + toollen)
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
            ProbeState = mc.mcSignalGetState(hsig)
                if ProbeState == 0 then
                    repeat
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                        wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
                        mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
                        ProbeState = mc.mcSignalGetState(hsig)
                    until(ProbeState == 1)
                    local zoffset = mc.mcAxisGetPos(inst, 2)
                    mc.mcToolSetData (inst, mc.MTOOL_MILL_HEIGHT, selectedtool, zoffset)
                    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                    --mc.mcToolSetCurrent(inst, selectedtool)
                    mc.mcCntlSetLastError(inst, "ToolChange Finished")
                else
            local zoffset = mc.mcAxisGetPos(inst, 2)
            mc.mcToolSetData (inst, mc.MTOOL_MILL_HEIGHT, selectedtool, zoffset)
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
            --mc.mcToolSetCurrent(inst, selectedtool)
            mc.mcCntlSetLastError(inst, "ToolChange Finished")
                end
        else
            wx.wxMessageBox("No tool length currently defined Lower Z to above touch plate, hit enter to start probe")
[color=red] --need a way to lower Z manually here and have not verified this portion of code--[/color]
           mc.mcCntlGcodeExecuteWait(inst," G91 G31 Z-.5 F25")
            ProbeState = mc.mcSignalGetState(hsig)
                repeat
                   mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
                   wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
                   mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z"..probestart.."\n G91 G31 Z-.5 F8")
                until(ProbeState ~= 0)
            mc.mcAxisSetPos(inst, 2, toolz)
            mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
            --wx.wxMessageBox("Please turn on spindle and click ok to continue") --can be removed if required
            --mc.mcToolSetCurrent(inst, selectedtool)
            mc.mcCntlSetLastError(inst, "ToolChange Finished")end
    end
    mc.mcToolSetCurrent(inst, selectedtool)
end

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

Pages: « 1 2 3 4 »