Hello Guest it is April 21, 2019, 04:56:14 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 - smurph

321
Mach4 General Discussion / Re: Hobby/Industrial and Profiles
« on: February 27, 2017, 07:12:59 PM »
The best thing yo do would be to package the profile up in your hobby installation and import it to your Industrial installation. 

Brains were replaced by LUA sripting in the screen's PLC script or by using the PMC (Programmable Machine Controller), which is a ladder logic front end.

Steve

322
Mach4 General Discussion / Re: UC100 Mach4 Lathe G83 fail
« on: February 27, 2017, 07:08:32 PM »
My point being is if Sim works and it doesn't on the uc100, then I suspect the uc100 plugin.  That is what we use Sim for mostly.  To verify proper operation of a hardware motion plugin.  If it doesn't work in Sim, then suspect a bug in Mach.  So the FIRST thing one should do if they have a problem is to test with Sim.  Because you will know who to talk to rather quickly. 

Steve


323
Mach4 General Discussion / Re: UC100 Mach4 Lathe G83 fail
« on: February 27, 2017, 05:49:16 PM »
Have you run it with Sim?  Works fine in Sim for me.  

Steve

324
Mach4 General Discussion / Re: Offset image in tool path window
« on: February 27, 2017, 02:07:12 PM »
Typically, one sets the offset BEFORE loading the G code file.  In other words, pick up your part zero first.  Then load the G code.  It isn't a bug but rather just how it works.  If you change your work offset, just hit regen tool path.  You can automate that with scripting, if you wish, but why?  Just press a button!  :)

Steve

325
Mach4 General Discussion / Re: Lua Macro Parameters
« on: February 25, 2017, 07:53:52 PM »
The first thing to understand is if you do ANYTHING from a GUI event that is long running, it will lock the GUI for that duration.  Why?  Because you have directed the thread that runs the GUI to run your code.  While it is doing that, it can't sit there and update DROs and work the buttons.  So the thing to do is hand off the task to another thread.  That is what mc.mcCntlMdiExecute() does.  It executes your code in a thread in the core. 

If you are running the stock screen set, take a look at the Modules directory.  mcMasterModule.lua.  That is a module file that is "required" by the screen load script.  This is the lua method of "including" common code.  Open up the screen load script in the screen editor and see how it is implemented. 

Otherwise, there is a bunch of really dry reading in the LUA programming manuals.  :(  The manuals are good, but damn...  painful to read.  LOL

Steve

326
Mach4 General Discussion / Re: Lua Macro Parameters
« on: February 25, 2017, 04:16:03 PM »
Use mc.mcCntlMdiExecute() from the button script.  It will be the same as running it in the mdi window.

Otherwise, the more proper way to run code from both the screen and a macro is to put the common code in a module.  Then require the module in both the screen script and the macro script.  Then all you need to do is call the lua module function.

Steve

327
Mach4 General Discussion / Re: Offset image in tool path window
« on: February 25, 2017, 04:10:04 PM »
After you set a work offset, you will have to regenerate the tool path. 

Steve

328
Mach4 General Discussion / Re: Preload-Tool Macro
« on: February 25, 2017, 04:07:27 PM »
No modbus on that thing at all.  I see where someone is working on Modbus integration, but nothing more.  I'm not sure how one would communicate with that PLC at all at the moment.  I can assure you, there will be NO threads about how to hook Mach 4 to that one.  So you are own you own.  Nothing like being the first to try and do something!!  :)

We do have serial comms via LUA.  http://lua-users.org/lists/lua-l/2012-09/msg00554.html  That may be what you have to do.  

For the price (in fact, cheaper), the Automation Direct Click PLCs are comparable and a LOT more powerful.  Stackable.  Need more I/O in the future, no problem.  https://www.automationdirect.com/adc/Shopping/Catalog/Programmable_Controllers/CLICK_Series_PLCs_(Stackable_Micro_Brick)/PLC_Units

Steve

329
That would be on the motor tuning page.  The velocity setting.  That will be the maximum velocity that the motor will do.  e.g. your rapid velocity.  The jog rate can then be set as a percentage of this max velocity.

Steve

330
Mach4 General Discussion / Re: Lua Macro Parameters
« on: February 24, 2017, 06:13:32 PM »
It is hard to simulate a macro with parameters because hParam is a handle to the parameters which just does not exists in the editor environment.  What I do is just set the variable to what you want to test with and ignore the parameter retrieval stuff while developing.  e.g. Set endX to a value and start debugging. 

Code: [Select]
--Reel Seat Insert
--Turn from current Z down to 0 from current X down to parameter D or .850

function m6690(hParam)
  local xNow,zNow,maxVal
  local TS,TR,TT --timer values Mach3 niy
  local plungeFeed=6
  local roughDOC=0.015
  local roughFeed=15
  local roughSpeed=900
  local finishDOC=0.004
  local finishFeed=8
  local finishSpeed=1400
  local inst=mc.mcGetInstance()
  local endX=.850 --param1()
 
  local inst=mc.mcGetInstance()

  mc.mcCntlSetLastError(inst,'')

  if (mc.mcInEditor() == 1) then
    endX = .850 --param1()
  else
    if (hParam ~= nil) then
      local DFlag = mc.mcCntlGetLocalVarFlag(inst, hParam, mc.SV_D)
      if(DFlag == 1) then
        endX = mc.mcCntlGetLocalVar(inst, hParam, mc.SV_D)
      end
    end
  end
  xNow = mc.mcAxisGetPos(inst,0)
  zNow = mc.mcAxisGetPos(inst,2)
  if xNow<=endX then
    wx.wxMessageBox("start X is less than end Diameter of "..tostring(endX))
    return
  end
  if zNow<=0 then
    wx.wxMessageBox("start Z is less than or = to 0")
    return
  end
  --ts=Timer
 
--rough cuts 
  mc.mcCntlGcodeExecuteWait(inst,"M3 S"..tostring(roughSpeed))
  while (mc.mcAxisGetPos(inst,0)>(endX+finishDOC*2)) do
    currPos=mc.mcAxisGetPos(inst,0)
    maxVal=math.max(endX+2*finishDOC,currPos)
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(maxVal-roughDOC))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(roughFeed).." Z0")
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    currPos=mc.mcAxisGetPos(inst,0)
    maxVal=math.max(endX+2*finishDOC,currPos)
    if currPos==endX+2*finishDOC then
      break
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(math.max(endX+2*finishDOC,currPos-roughDOC)))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(roughFeed).." Z"..tostring(zNow))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end 
    if currPos==endX+2*finishDOC then
      break
    end 
  end
  -- tr=Timer-ts
  --wx.wxMessageBox("Roughing Time: "..tostring(tr))

  --finish cuts
  mc.mcCntlGcodeExecuteWait(inst,"M3 S"..tostring(finishSpeed))

  while (mc.mcAxisGetPos(inst,0)>=(endX+finishDOC)) do
    currPos=mc.mcAxisGetPos(inst,0)
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(currPos-finishDOC))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(finishFeed).." Z0")
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
        return
    end
    currPos=mc.mcAxisGetPos(inst,0)
    if currPos==endX then
      break
    end 
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(plungeFeed).." X"..tostring(currPos-finishDOC))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    mc.mcCntlGcodeExecuteWait(inst,"G01 F"..tostring(finishFeed).." Z"..tostring(zNow))
    if mc.mcSpindleGetSensorRPM(inst)==0 then
      wx.wxMessageBox("Spindle Stopped")
      return
    end
    currPos=mc.mcAxisGetPos(inst,0)
    if currPos==endX then
      break
    end 
  end
  mc.mcCntlGcodeExecuteWait(inst,"M5\nM9")
--te=Timer-ts
--wx.wxMessageBox("Roughing Time: "..tostring(tr).." - Total Time: "..tostring(te))
end
 
if (mc.mcInEditor() == 1) then
    m6690()
end   

Steve