Hello Guest it is April 25, 2019, 04:30:32 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 - smurph

Mach4 General Discussion / Re: homing 2 axis
« on: October 21, 2018, 02:56:03 PM »
This would all depend on how the motion plugin handles homing, meaning homing is a motion controller function.  The correct behavior would be where motor 1 hits its' home switch first, stops, and motor 3 continues to its' home switch. 

So the question now becomes what motion controller are you using?


-30 is MERROR_NOT_COMPILED.  This means that there is a macro with a syntax error that could not compile.  The system tries to compile all of the macros that have changed since the last compile when the control is reset.  Loading a file does an implicit reset on the control.


Make sure your the settings in the config dialog are correct.  e.g. T on M6 line is too to use. 


Mach4 General Discussion / Re: Calling one G-Code file from another
« on: September 28, 2018, 11:58:30 PM »
In a word, subprograms.  :)  Watch this video and see the magic.  https://www.youtube.com/watch?v=fT0wjbO4NpE

The idea would be that each of your different functions would be a a subprogram.  Then any main part program could call them. 


Mach4 General Discussion / Re: Macros for lathe spindle range change
« on: September 16, 2018, 12:27:02 AM »
local NextSpindleRange = mc.mcCntlGetLocalVar(inst, hVars, mc.SV_P)

That line pulls the P word from the G code line.  It will be hard to debug in the editor since you can't really execute a G code line.  There are also these related functions available:

flag, rc = mc.mcCntlGetLocalVarFlag(number inst, number hVars, number varNumber)  -- This one tels you if the G code word was set on the G code line.  e.g.  "M101 P1"

Code: [Select]
local flag
flag, rc = mc.mcCntlGetLocalVarFlag(inst, hVars, mc.SV_P)  -- flag would equal 1 because P1 was specified on the G code line.
flag, rc = mc.mcCntlGetLocalVarFlag(inst, hVars, mc.SV_Q)  -- flag would equal 0 because Q was specified on the G code line.

comment, rc = mc.mcCntlGetLocalComment(number inst, number hVars) -- retrieve the comment on the G code line that contains the M code. 

As I said earlier, it is hard to debug these things because no G code line has been executed when debugging in the script editor.  So I put in a little helper API function that will simulate it.  :)

hVars, rc = mc.mcCntlCreateLocalVars(number inst, string gCodeLine)

It would be used in the function call stub like this:

Code: [Select]
if (mc.mcInEditor() == 1) then
   -- The function call stub is only ever executed when in the editor debugging, so it is safe to leave this in for testing.
   local inst = mc.mcGetInstance()
   local hVars, rc
   hVars, rc = mc.mcCntlCreateLocalVars(number inst, string gCodeLine)

There are caveats to passung G code words to M codes.  One is you can't use the M word as a variable.  You can use a word more than once.  And finally, the M code that takes variables has to be the only thing on the line. 


Mach4 General Discussion / Re: Macros for lathe spindle range change
« on: September 15, 2018, 02:22:03 AM »
A lot of machines use M40 and up to set the range.  For example, M40, M41, and M42 for a three range spindle.  All of those M code macro script would be implemented like GerdS example with the exception of no input parameter.  The range would be hard coded. 


Mach4 General Discussion / Re: mcTouchOff Dialog
« on: September 12, 2018, 01:53:43 AM »
There is the API manual in the docs folder that addresses the mc. namespace/library/table.  As for the wx. stuff, that is wxLUA and the documentation is on that web site.  However, they kind of expect you to know the wxWidgets API or use the wxWidgets C/C++ API docs and "translate" the C/C++ functions to the LUA syntax.  The wxWidgets API is expansive and there is no possible way we would ever document it.  Unless you are writing wizards or GUI stuff, there really isn't any need for the wx. stuff.  But it is there if you want to get crafty and don't mind a learning curve. 


Mach4 General Discussion / Re: DRO,s scaling error
« on: September 12, 2018, 01:33:47 AM »
What build are you running?  Try the latest from the website. 


Mach4 General Discussion / Re: IMTS 2018
« on: September 05, 2018, 05:17:33 PM »
I won't be there this year.  :(  I do plan on going to FabTech in Atlanta on Nov. 6, 7, and 8. 


Using the PMC is even easier.  Do the same creation of inputs in the the keyboard plugin and map them directly to the desired action in the PMC.  You don't have to map them to Mach signals this way.