Hello Guest it is April 19, 2024, 08:34:03 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 - rhtuttle

321
Mach4 General Discussion / Re: Mach Motion Lathe Wizards Bug? Help.
« on: February 03, 2018, 01:53:56 PM »
Took a look at your pictures of the code and the settings.  First thing that I notice is that the spindle speed and the feed rate in the code are the rates that you have for the finishing pass settings.  Yet your screen shot of the settings has the finishing pass grayed out which is correct for the type of groove you have selected.  So this code was not generated from these settings.

The file name of the code is not what you get from Post directly from the canned cycles or from View Toolpath.  This file is from some other time you have ran the grooving widget.

Try this, go back into the grooving widget and put your tool and offset to 3 and 14 and then select view toolpath.  Line N0080 should read T0314 (Tool Change).  If it does then we know that you are not using the canned cycle widget correctly.  If it doesn't you need to open a ticket with NFS.

I'm sure you have the widget settings set to 'Load Last Cycles' instead of 'Use Defaults'.  I don't think that the settings are saved unless you 'Add to Job' and save the job.

RT

322
Mach4 General Discussion / Re: Mach Motion Lathe Wizards Bug? Help.
« on: February 02, 2018, 05:46:22 PM »
Just ran the parting wizard here with the pocket and offset set to 3 and 14 and hit the view toolpath and here is part of the result:

...
N0065 %
N0070 G00 G40 G18 G54 G64 G80 G90.1 G99 G20 (Safe Start Block)
N0075 %

N0080 T0314 (Tool Change)
N0085 G98 (Feed per Minute)
N0090 G97 S2000 (Constant Speed)
N0095 M03 (Spindle Forward)
...

so I can't replicate your  results.  Does the date and time of the gcode coincide with the time you ran the wizard?

RT

323
Mach4 General Discussion / Re: Trouble with M3 and spindle speed
« on: February 01, 2018, 10:49:55 AM »
Not unless you have a need to change the default behavior.  Your code shouldn't be causing this behavior on your physical machine since it runs on the simulator.  It is more likely your motion controller doesn't like one of the codes and stops.  Have you tried eliminating the P7 from the code?

RT

324
Mach4 General Discussion / Re: Trouble with M3 and spindle speed
« on: February 01, 2018, 10:39:11 AM »
No it is not.  It is how you can change the behavior of a M3 command.  Just wanted to make sure that you hadn't put one in and forgot or if you had that the code was okay.

325
Mach4 General Discussion / Re: Mach Motion Lathe Wizards Bug? Help.
« on: February 01, 2018, 10:36:23 AM »
Peck drilling is a canned cycle that remains in effect until a G80 is issued.  Every time you make a move it will issue another peck cycle.  Check the code to see if a g80 is issued after each peck cycle.

HTH

RT


326
Mach4 General Discussion / Re: Mach Motion Lathe Wizards Bug? Help.
« on: January 31, 2018, 11:22:46 PM »
Could you post the offending code generated by the wizard along with the settings you entered?

327
Mach4 General Discussion / Re: Trouble with M3 and spindle speed
« on: January 31, 2018, 04:26:34 PM »
Runs fine in the simulator.

Do you have a spindleSpeed.mcs in your macros directory?  if so post a copy.

What is the p7

328
Mach4 General Discussion / Coroutines, Button Scripts, Modules, Probing
« on: January 31, 2018, 01:47:20 PM »
I am posting this as a means of saying thank you to all of you that have helped me to begin to understand how Mach4 operates and hope that this serves as a jump start for all of the new users of Mach4

This example shows:
How to use a coroutine in a button script so the GUI does not lock while probing.
The use of a module so that the routine can be used by any button.
Using Lua's ability to return multiple values from a function
Use of registers used by Mach4 for probe
Use of global vars set with the screen load script load modules section
Use of the scr variable to retrieve and set screen elements
Use of relative movements in Lathe since fanuc lathes do not recognize G91

A big thank you to DazTheGas for his video on coroutines: https://www.youtube.com/watch?v=t2xQYvAXT8o&feature=youtu.be
and to Brannab for her video on using the screen editor: https://www.youtube.com/watch?v=P1xZkFgS5cQ

Be sure to watch both of these if your new to Mach4.

The file 'load_modules.mcs' residing in the profile's '\Macros' directory and loads any of your self defined modules for the profile being used.

Code: [Select]
---------------------------------------------------------------
-- C:\Mach4Hobby\Profiles\MyTurn4\Macros\load_modules.mcs
-- Load modules that you want to be able to use from Mcodes
---------------------------------------------------------------
inst = mc.mcGetInstance()
local profile = mc.mcProfileGetName(inst)
local path = mc.mcCntlGetMachDir(inst)

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

--ErrorCheck module
package.loaded.mcErrorCheck = nil
ec = require "mcErrorCheck"

mm = require "mcMasterModule" -- resides: C:\Mach4Hobby\Modules
prb = require "mcProbing"     -- resides: C:\Mach4Hobby\Modules
rt = require "rtMyModule"     -- resides: C:\Mach4Hobby\Profiles\MyTurn4\Modules
gs = require "GcodeScripter"  -- resides: C:\Mach4Hobby\Profiles\MyTurn4\Modules


The following is one of the functions (probe) I use in a module 'rtMyModule.lua' that resides in the profile's '\Modules' subdirectory.  The function could be defined and used in a button script but would then not be available to any other button calls.  I use this function for five buttons on a tab I created.

Code: [Select]
local rtModule = {}

-- probes using relative positioning and returns the work and machine coordinates of a successful strike
-- rc==nil for failure and rc==0 for success
function rtModule.probe(prbNmbr,axis,dis,spd)
  if prb==nil then
    --build:3481 prb and mm are initialized in the load script. mcMasterModule.lu and mcProbing.lua
    wx.wxMessageBox('prb is nil')
    return nil,nil,nil
  end
  if not prb.CheckProbe(1,tonumber(prbNmbr)) then--CheckProbe throws an error message if probe is obstructed
    return nil,nil,nil
  end
  axis=string.upper(axis)
  --set vars for the axis to probe and their vars, see Mill GCode Programming.pdf page 19 g31
  --Lathe does not recognize G91 so axes are represented by alternate letters for relative positioning
  if axis=='Z'then
    prb.NilVars(5063,5063)
    prb.NilVars(5073,5073)
    relAxis='w'   
    mcAxis=mc.Z_AXIS
  elseif axis=='X'then
    prb.NilVars(5061,5061)
    prb.NilVars(5071,5071)
    relAxis='u'   
    mcAxis=mc.X_AXIS
  elseif axis=='Y'then
    prb.NilVars(5062,5062)
    prb.NilVars(5072,5072)
    relAxis='v'
    mcAxis=mc.Y_AXIS
--[[ need axis alternate letters for A,B,C
  elseif axis=='C'then
    prb.NilVars(5066,5066)
    prb.NilVars(5076,5076)
    relAxis='h' 
    mcAxis=mc.C_AXIS
  --]]
  else
    wx.wxMessageBox('Invalid Axis: '..axis)
  end;

  --execute the gcode and call the coroutine to let the GUI be updated
  --these two lines act like what you would expect mcCntlGcodeExecuteWait to do
  mc.mcCntlGcodeExecute(mc.mcGetInstance(),'g'..tostring(prbNmbr)..relAxis..tostring(dis)..' f'..tostring(spd))
  coroutine.yield()

  --check for valid probe strike
  local rc=mc.mcCntlProbeGetStrikeStatus(mc.mcGetInstance())
  if rc==0 then
    wx.wxMessageBox('Fault: No Probe Strike')
    return nil,nil,nil
  end;

  --find where the probe made contact
  local posWrk,rc=mc.mcAxisGetProbePos(mc.mcGetInstance(),mcAxis,0)--probe Strike Position Work Coords
  local posMach,rc=mc.mcAxisGetProbePos(mc.mcGetInstance(),mcAxis,1)--probe Strike Position Machine Coords

  --at this point you could execute more probes by:
  -- local s='g1'..tostring(prbNmbr)..relAxis..tostring(-dis)..'\n' --back off
  -- s=s..'g'..tostring(prbNmbr)..relAxis..tostring(dis)..'\n'      --probe
  -- mc.mcCntlGcodeExecute(mc.mcGetInstance(),s)
  -- coroutine.yield()

  return posWrk,posMach,0 --return the work and machine coordinates for the strike and indicate success with 0
end

return rtModule

--Button code to probe from current position for x minus direction

Code: [Select]
wait=coroutine.create(  --wait defined in PLC script found in screen edit mode top entry in the Screen Tree Manager
  function ()
  -- set results initially to nil for visual confirmation of good or bad result
  scr.SetProperty('txtProbeResult','Value','nil')
  scr.SetProperty('txtProbeResultMach','Value','nil')
  scr.SetProperty('txtProbeOver','Value','nil')
  -- get parameters
  local prbCde=scr.GetProperty('txtProbeCode','Value') --which probe input is being used: 31.0 31.1,31.2,31.3
  local dis=scr.GetProperty('txtProbeDistance','Value') -- max distance to probe
  local spd=scr.GetProperty('txtProbeSpeed','Value') -- speed to probe at
  local prbDia=tonumber(tostring(scr.GetProperty('txtProbeDiameter','Value'))) --used for tool setting calculation

  --call the probe function defined in Module rtMyModule.lua, rt set in Screen Load Script Load Module section
  --probe returns the position of the probe strike in work and machine coordinates
  -- probe returns nils for unsuccessful probe attempt
  local prbWrk,prbMach,rc=rt.probe(prbCde,'x','-'..dis,spd)
  if rc~=0 then
    return
  end

  local prbOver=mc.mcAxisGetMachinePos(mc.mcGetInstance(),mc.X_AXIS) -- overshoot of probe
  local prbErr=math.Wrk(prbMach-prbOver)  -- difference between Strike point and stop/overshoot point

  -- 0==success, update results
  if rc==0 then
    scr.SetProperty('txtProbeResult','Value',string.format('%.5f',prbWrk))
    scr.SetProperty('txtProbeResultMach','Value',string.format('%.5f',prbMach))
    scr.SetProperty('txtProbeOver','Value',string.format('%.5f',prbErr))
    mc.mcCntlSetLastError(mc.mcGetInstance(),'X Probe Complete')
  end
end
)

HTH

RT

329
Mach4 General Discussion / Re: Mach4 Lathe 3481 Demo, Inc. Jog, Dia mode
« on: January 30, 2018, 05:53:49 PM »
I don't think you can change that behavior. Probably best to open a ticket with NFS on this one.

330
Mach4 General Discussion / G91 - Lathe
« on: January 30, 2018, 04:23:24 PM »
Since lathe doesn't have a g91 you swap letters for relative moves
x ->u
y->v
z->w
a->?
b->?
c->h?

Anyone know the abc for sure?

TIA

RT