Hello Guest it is March 28, 2024, 09:26:10 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.


Topics - rhtuttle

Pages: « 1 2 3 4 5 6 7 8 9 »
31
Mach4 General Discussion / Tool Table Numbering Approach
« on: August 07, 2018, 06:05:36 PM »
Looking for some advice on what approach to take for tool table numbering when you have a lot of drill bits and reamers.

I have several sets of drilling operations that require different sized drill bits, 135 deg and flat bottom, reamer and blind hole lap.

Since Mach4 has 99 tool entries (256?) what approach would you take to numbering each?

Would it be better to have a macro change the same 4 tools entries each time you run?

If you can have more than 99 tools and T1010 sets tool ten what is the syntax for tool 215?

TIA

RT

32
Trying to determine if my coding is incorrct or if Mach4 or PMDX411 is incorrect.

using the following code to produce tick marks on a dial.  the first example uses an incremental approach to advance the C axis for each tick.  The 2nd uses absolute positioning.

They produce different results
move h, deg

Code: [Select]
local n=scr.GetProperty('droNmarks','Value')
local dpth=scr.GetProperty('droMarkXdepth','Value')
local lngth=scr.GetProperty('droMarkXlength','Value')
local deg=360/n
local i,s
s=''
for i=1,n do
  s=s..'g0 z-'..lngth..'\ng0 x-'..dpth..'\ng0z0\ng0x0\ng0 h'..tostring(deg)..'\n'
end
s=s..'g0 c0'
mc.mcCntlMdiExecute(mc.mcGetInstance(),s)

Absolute, move c, deg*i
Code: [Select]
local n=scr.GetProperty('droNmarks','Value')
local dpth=scr.GetProperty('droMarkXdepth','Value')
local lngth=scr.GetProperty('droMarkXlength','Value')
local deg=360/n
local i,s
s=''
for i=1,n do
  s=s..'g0 z-'..lngth..'\ng0 x-'..dpth..'\ng0z0\ng0x0\ng0 c'..tostring(deg*i)..'\n'
end
s=s..'g0 c0'
mc.mcCntlMdiExecute(mc.mcGetInstance(),s)


The latter gives correct results but both should be the same.


TIA

RT

33
Mach4 General Discussion / Zero Brane - bryannab
« on: April 24, 2018, 10:42:37 AM »
Bryannab,

How about a video on how to use Zero Brane to debug macros, screen scripts and modules?  Breakpoints, debug servers...

TIA

RT

34
Mach4 General Discussion / mcCntrlGcodeExecuteWait fail
« on: April 09, 2018, 01:19:25 PM »
I have a macro that generates a string of gcode listed below.  If I pass that string to mc.mcCntlGcodeExecuteWait(inst,s) it executes to the x1.320 then skips the rest of the gcode in the string and executes the remaining macro code after the mc.mcCntlGcodeExecuteWait(inst,s). Is there a limitation as to how many characters/commands that can be included and executed in a string with executeWait?  This code executes as a gcode file so I know it is not the code.

Code: [Select]
m3 s1400
g1 x1.5800 f1.000
g1 z0.0000 f12.000
g1 x1.5600 f1.000
g1 z0.2000 f12.000
g1 x1.5400 f1.000
g1 z0.0000 f12.000
g1 x1.5200 f1.000
g1 z0.2000 f12.000
g1 x1.5000 f1.000
g1 z0.0000 f12.000
g1 x1.4800 f1.000
g1 z0.2000 f12.000
g1 x1.4600 f1.000
g1 z0.0000 f12.000
g1 x1.4400 f1.000
g1 z0.2000 f12.000
g1 x1.4200 f1.000
g1 z0.0000 f12.000
g1 x1.4000 f1.000
g1 z0.2000 f12.000
g1 x1.3800 f1.000
g1 z0.0000 f12.000
g1 x1.3600 f1.000
g1 z0.2000 f12.000
g1 x1.3400 f1.000
g1 z0.0000 f12.000
g1 x1.3200 f1.000  (executes up to and including this line)
g1 z0.2000 f12.000
g1 x1.3000 f1.000
g1 z0.0000 f12.000
g1 x1.2800 f1.000
g1 z0.2000 f12.000
g1 x1.2600 f1.000
g1 z0.0000 f12.000
g1 x1.2400 f1.000
g1 z0.2000 f12.000
g1 x1.2200 f1.000
g1 z0.0000 f12.000
g1 x1.2000 f1.000
g1 z0.2000 f12.000
m5

TIA

RT

35
PoKeys / PoKeys57CNC, support for g31.1,g31.2,g31.3
« on: February 20, 2018, 07:17:50 PM »
Does PoKeys57CNC have support for Mach4 Probe1,Probe2,Probe3 for g31.1,g31.2,g31.3?

TIA

RT

36
Mach4 General Discussion / Probe1, Probe2,Probe3, PMDX411
« on: February 20, 2018, 06:27:53 PM »
1. When configuring Mach4 input pins I have digitize set to 10 and it is working.  But the only other Probe showing in the input signal configuration dialog is Probe3.  Where are Probe1 and Probe2? 

2. When I assign any of the pins to Probe3 I get a message from the pmdx411 smartBob that the Mach4 Probe3 is not supported and will be ignored.  Does that mean you may only have one digitize/probe with the pmdx411?  No support for g31.1, g31.2 or g31.3?

TIA

RT

37
Mach4 General Discussion / M1 optional stop
« on: February 19, 2018, 01:07:08 PM »
It appears that m1 'optional stop' only works when running a gcode file.  It has no affect in the MDI, mcCntlGcodeExecute, mcCntlMDIExecute or mcCntlGcodeExecuteWait.

I assumed (silly me) that execution of gcode would be the same across all execute requests.  How would you recommend accomplishing the same effect in a macro or button script?

Executewait,messagebox,executewait,messagebox,execute?

TIA

RT

38
Mach4 Toolbox / Radio and Checkbox examples
« on: February 15, 2018, 02:56:02 PM »
Attached is a group box that can be imported into your screen set.  I keep it hidden and when I need a checkbox or group of radio buttons I just copy what I need from it to wherever I need it.  The buttons show how you would access the state.

download the txt and remove the txt extension and then it can be imported into your screen set.

HTH

RT


39
Mach4 General Discussion / Can mcScriptExecute be called from a macro?
« on: February 10, 2018, 04:34:50 PM »
Can mcScriptExecute be called from a macro?

I have deleted some file and path checking to verify that the full path and filename are correct and found.  The 'TestScript.mcs' simply contains a mc.mcCntlSetLastError message.  When run in the editor you can step through the code, it hangs for a few seconds on the script execute then moves to the next line.  After completing the debug the editor declares itself closing due to an error. 

function m9001()
    mc.mcScriptExecute(0,'c:\\mach4Hobby\\profiles\\MyTurn4\\macros\\'..'TestScript.mcs',false)
end

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

Is using mcScriptExecute in a macro not allowed?

TIA

RT

40
Since I don’t use a CAM program often I find myself writing macros and always need to know what settings are current.

I’m not very good at remembering which parameters and letters are supposed to be sent for macros that I created awhile ago.  You know, m6875 D.25 L1.5 P15…which did d, l and  P stand for?  And in your macro having to grab the values from the param list.

if (hVars ~= nil) then
    local DFlag = mc.mcCntlGetLocalVarFlag(inst, hVars, mc.SV_D)
    if(DFlag == 1) then
      local dia = mc.mcCntlGetLocalVar(inst, hVars, mc.SV_D)
    end
    local LFlag = mc.mcCntlGetLocalVarFlag(inst, hVars, mc.SV_L)
    if(LFlag == 1) then
      local length = mc.mcCntlGetLocalVar(inst, hVars, mc.SV_L)
    end
    local DFlag = mc.mcCntlGetLocalVarFlag(inst, hVars, mc.SV_P)
    if(PFlag == 1) then
      local DOC= mc.mcCntlGetLocalVar(inst, hVars, mc.SV_P)
    end
  end

Wouldn’t it be nice if you could just read the values from the panel dro’s, led’s,… from your macro
function m6875()
local dia=myModule.getProperty(‘droDia’,’Value’)
local length=myModule.getProperty(‘txtLength’,’Value’)
local DOC=myModule.getProperty(‘droDia’,’Value’)

end

With the following additions you can get/set screen properties.  Concept:

Create 4 gRegs0 registers:
gRegs0:gpFlag
gRegs0:gpComponentName
gRegs0:gpComponentAttribute
gRegs0:gpComponentResult

Macro calls for getting/setting a component’s property through a module function that sets registers and sets a register flag to request the action. Then waits for the flag to indicate that it is finished.
PLC monitors a register to determine if a get or set property has been called by a macro, when requested, calls the function in the Load Script
Load script function reads the component name and component property from registers and either gets/sets the property.  Posts the result in a register and sets the flag that it is finished.

PLC monitor

Code: [Select]
------------------------------------------------------------------
--PLC script addition
------------------------------------------------------------
-- checks to see if macro/module has requested a screen property --myChangeProperty()
------------------------------------------------------------

local hReg,rc= mc.mcRegGetHandle(inst,'gRegs0/gpFlag')
if hReg~=nil then
  local flag=mc.mcRegGetValue(hReg)
  if flag==0 then return end      --no request
  if flag==1 then                 --new request to get a property
    mc.mcRegSetValueLong(hReg,2)  --set flag to processing request
    myGetProperty()               --get the requested data and set result and set flag to 0
  end
  if flag==3 then                 --new request to set a property
    mc.mcRegSetValueLong(hReg,2)  --set flag to processing request
    mySetProperty()               --set the requested property and set result and set flag to 0
  end
end

Screen Load Functions

Code: [Select]
------------------------------------------------
--Add to Screen Load Script
------------------------------------------------
function myGetProperty()
  local hflag=mc.mcRegGetHandle(inst,'gRegs0/gpFlag')
  local hcmp=mc.mcRegGetHandle(inst,'gRegs0/gpComponentName')
  local hattr=mc.mcRegGetHandle(inst,'gRegs0/gpComponentAttribute')
  local hrslt=mc.mcRegGetHandle(inst,'gRegs0/gpComponentResult')
 
  local Cname=mc.mcRegGetValueString(hcmp)
  local Cattr=mc.mcRegGetValueString(hattr)
  local Rslt,rc=scr.GetProperty(Cname,Cattr)

  if (rc == mc.MERROR_NOERROR) then
    mc.mcRegSetValueString(hrslt,tostring(Rslt))
    mc.mcRegSetValueString(hcmp,'')
    mc.mcRegSetValueString(hattr,'')
    mc.mcRegSetValue(hflag,0)
  elseif rc~=nil then
    mc.mcRegSetValueString(hrslt,'')
    mc.mcRegSetValue(hflag,rc)
  end
end 
 
function mySetProperty()
  local hflag=mc.mcRegGetHandle(inst,'gRegs0/gpFlag')
  local hcmp=mc.mcRegGetHandle(inst,'gRegs0/gpComponentName')
  local hattr=mc.mcRegGetHandle(inst,'gRegs0/gpComponentAttribute')
  local hrslt=mc.mcRegGetHandle(inst,'gRegs0/gpComponentResult')
 
  local Cname=mc.mcRegGetValueString(hcmp)
  local Cattr=mc.mcRegGetValueString(hattr)
  local Rslt=mc.mcRegGetValueString(hrslt)
  local rc=scr.SetProperty(Cname,Cattr,Rslt)
  if (rc == mc.MERROR_NOERROR) then
    mc.mcRegSetValueString(hrslt,Rslt)
    mc.mcRegSetValueString(hcmp,'')
    mc.mcRegSetValueString(hattr,'')
    mc.mcRegSetValue(hflag,0)
  elseif rc~=nil then
    mc.mcRegSetValueString(hrslt,'')
    mc.mcRegSetValueString(hflag,rc)
  end
end 

Module Code

Code: [Select]
------------------------------------------------------------------
--Module definition
------------------------------------------------------------------
local rtModule = {}
  function rtModule.rtChangeProperty(cName,cAttr,getSet,vlu)
  local hflag=mc.mcRegGetHandle(inst,'gRegs0/gpFlag')
  local hcmp=mc.mcRegGetHandle(inst,'gRegs0/gpComponentName')
  local hattr=mc.mcRegGetHandle(inst,'gRegs0/gpComponentAttribute')
  local hrslt=mc.mcRegGetHandle(inst,'gRegs0/gpComponentResult')
   
  mc.mcRegSetValueString(hcmp,cName)
  mc.mcRegSetValueString(hattr,cAttr)
  mc.mcRegSetValue(hflag,getSet)
  mc.mcRegSetValueString(hrslt,tostring(vlu))
  wx.wxMilliSleep(200)
  while mc.mcRegGetValue(hflag)==2 do
    wx.wxMilliSleep(100)
  end
  local Rslt,rc=mc.mcRegGetValueString(hrslt)
  return Rslt
end 

function rtModule.rtGetProperty(cName,cAttr)
  return rtModule.rtChangeProperty(cName,cAttr,1)
end;

function rtModule.rtSetProperty(cName,cAttr,vlu)
  if vlu==nil then wx.wxMessageBox('Invalid Value') return end
  return rtModule.rtChangeProperty(cName,cAttr,3,vlu)
end;

return rtModule

Macro

Code: [Select]
-------------------------------------------------------------------------
--Macro for testing
--------------------------------------------------------------------------

function m995() 
--  local rslt=rt.rtGetProperty('ledMeasOnly','Value')
--  local rslt=rt.rtSetProperty('ledMeasOnly','Value',1)
 -- local rslt=rt.rtSetProperty('btn(70)','Label','new test')
--  local rslt=rt.rtSetProperty('droProbeDia','Value',0.665)

  wx.wxMessageBox('In 995: '..tostring(rslt))
end

Obviously this can be used for many other tasks beside an alternate way of getting macro parameters.

HTH


Pages: « 1 2 3 4 5 6 7 8 9 »