Hello Guest it is March 28, 2024, 01:17:42 PM

Author Topic: Mcodes ??  (Read 13534 times)

0 Members and 1 Guest are viewing this topic.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Mcodes ??
« on: November 28, 2014, 11:02:59 PM »
Has anyone given any thought as to what AUX Mcodes need to be created ?  Standardizing the Mcode woul dmake POST creation a lot easier rather than having to create many different post ofr many different Mcode definitions.

I have looked at several major players in the CNC control world  and there ARE some standards as far as standards go(;-)



Just a thought, (;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mcodes ??
« Reply #1 on: November 28, 2014, 11:12:48 PM »
When creating a Mcode is it possible in LUA to have outside parameter calls like we had in Mach3 ???

M102 Pxx Qxx Rxx


(;-) TP
Re: Mcodes ??
« Reply #2 on: December 01, 2014, 10:17:28 AM »
This is a example of how to read parameters in a Mcode for Mach4.  You can use any of the parameters in this list.

-----------------------------------------------------------------------------
-- Machine Type: Standard Mill Control
-- Author: MachMotion Development Team
-- Created: 09/24/2013
-- Modified by: MachMotion Development Team
-- Modified on: 01/10/2014
-- Description: Example: Reading Variables into MCodes
-- Copyright: © 2013-2014 Edge Solutions LLC All Rights Reserved
-----------------------------------------------------------------------------

function m700(hVars)
   local macroname = "m700"
   local a,b,c,rc
   local inst = mc.mcGetInstance() -- Get the current instance

   local nilPoundVar = mc.mcCntlGetPoundVar(inst,0)
   
   local message = ""
   if hVars ~= nil then
      
        local ParameterLetterArray = {"A", "B", "C", "D", "E", "F", "H", "I", "J", "K", "L", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
        local ParameterNumberArray = {mc.VAR_A, mc.VAR_B, mc.VAR_C, mc.VAR_D, mc.VAR_E, mc.VAR_F, mc.VAR_H, mc.VAR_I, mc.VAR_J, mc.VAR_K, mc.VAR_L, mc.VAR_P, mc.VAR_Q, mc.VAR_R, mc.VAR_S, mc.VAR_T, mc.VAR_U, mc.VAR_V, mc.VAR_W, mc.VAR_X, mc.VAR_Y, mc.VAR_Z}
        for i = mc.VAR_A, #ParameterNumberArray do
         rc = mc.mcCntlGetLocalVar(inst, hVars, ParameterNumberArray)
         message = message .. "#" .. ParameterLetterArray .. ":" .. tostring(rc) .. ", "
      end
      wx.wxMessageBox(message)
   end
   return nil, true, macroname .. " Ran Successfully"
end

if (mc.mcInEditor() == 1) then
    m700()
end
Andrew
MachMotion
Re: Mcodes ??
« Reply #3 on: December 01, 2014, 10:51:17 AM »
-----------------------------------------------------------------------------
-- Machine Type: Standard Mill Control
-- Author: MachMotion Development Team
-- Created: 09/24/2013
-- Modified by: MachMotion Development Team
-- Modified on: 01/10/2014
-- Description: Example: Reading Variables into MCodes
-- Copyright: © 2013-2014 Edge Solutions LLC All Rights Reserved

This is what you can do with a "Development Team" and a Year or more head start,   :o
Cool, thanks Andrew and Team
I always like to learn something new.  8)

« Last Edit: December 01, 2014, 10:52:59 AM by Ya-Nvr-No »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mcodes ??
« Reply #4 on: December 01, 2014, 10:53:37 AM »
OK I am assuming that it works like

M700 A1.5 B2.5

And that the Vars's should print out on the message bar ??

Are the ABC,etc the same as #vars in Gcode ??

Please explain how it is to work.  I ran it but did not get as expected.

(;-)
Re: Mcodes ??
« Reply #5 on: December 01, 2014, 10:57:05 AM »
M700 A1.5 B2.5

That should work fine... I will post the mcodes so you can download and test.
Andrew
MachMotion
Re: Mcodes ??
« Reply #6 on: December 01, 2014, 10:59:07 AM »
Attached is the M700 mcode. Example: M700 A2 B3
Andrew
MachMotion
Re: Mcodes ??
« Reply #7 on: December 01, 2014, 11:02:46 AM »
This is what you should see in the test.  All the rest of the Vars are nil and thats why they display the odd number.  If you want to see if a var is nil compare it to: local nilPoundVar = mc.mcCntlGetPoundVar(inst,0).  If its nil it will = nilPoundVar.
Andrew
MachMotion

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mcodes ??
« Reply #8 on: December 01, 2014, 11:03:32 AM »
OK ARe the abc,etc used in the Macro array the SAME as the Gcode #var abc. If so there is a problem.

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Mcodes ??
« Reply #9 on: December 01, 2014, 11:09:37 AM »
I put this in the MDI  press cycle start and I get NOTHING it appears to run but NO messageBox

M700 A111 B222

(;-) TP