Hello Guest it is September 29, 2020, 12:33:13 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: delay
« on: February 14, 2019, 12:23:42 AM »
Ok, try looking at the state of the machine, as Craig alluded to.

In the cycle start button, you can put some more scripting in the up event script. 

local mstate = mc.mcCntlGetState()
if (mstate == mc.MC_STATE_HOLD) then
    wx.wxMilliSleep(2000) -- two seconds.


Mach4 General Discussion / Re: Connect to Mach4 using VS 2012 C++
« on: February 14, 2019, 12:18:39 AM »
One would need to link to MachAPI.dll via the MachAPI.lib to write a GUI to replace the Mach4GUI.exe.  Otherwise, an app to monitor or control the core along side the Mach4GUI would link to MachIPC.dll via MachIPC.lib.  MachAPI.h is the header to use with both of the link libraries.  All of these are in the SDK and require a developer key. 


Mach4 General Discussion / Re: Sending Info to a Database from a Script
« on: February 12, 2019, 12:38:19 AM »
What version (build) of Mach are you running?  The luasql module have never been in the addons directory to my knowledge. 

Should be:


Mach4 General Discussion / Re: Screen Set Property Descriptions
« on: February 09, 2019, 09:55:22 PM »
There is no documentation of our internal screen format.  You are own your own in there...  I will say that the font property is specific to the OS and I have NO idea what it comprises. 

No Bg color is transparent in some places and opaque in others.  Again, this is an OS thing.  You pretty much can't have a transparent tab in MS Windows.  So the controls that are laid upon a tab WILL take on the tab Bg Color.

It is not possible for a user to create new label codes.  They have to be programmed into the GUI.  If you have ideas for some, put them in the feature request thread. 

SysVars are G code variables.  #100, #1100, #1200, etc...  SysVars can be used to create custom parametric G code programs. 

SysParams are system parameters.  SysParams define the control behavior.  They are changed with G10L50 and read with PRM[ x ] (where x is the desired parameter).  There are not many things a user would ever need to change in the SysParams.  Most of these only pertain to the Industrial license with Macro B.  Tool life management, Custom G codes, etc... 

The DRO font size is intetionally programmed to fill the height of the element.  If that doesn't fit the desired look, then make the DRO flat with no border and put a faux background bitmap behind it.  The sky is the limit.


Mach4 General Discussion / Re: Sending Info to a Database from a Script
« on: February 08, 2019, 03:48:53 PM »
Because LuaSQL via Luarocks was not installing - maybe I did not need to do that ...
We went to the odbc driver for a MySQL connection and set up the connection in the windows ODBC connection.

We provide the luasql modules in the Mach installation forlder's "Modules" directory.  Luarocks isn't needed or desired unless you have a separate LUA installation that you also want to have lausql connectivity. 

I will double check to see if MySQL installer placed them in the %path% variable but I think that is correct - I try to point to the original rather than a copy located elsewhere - as upgrades may / will require that specific version. Just easier.

The MySQL installer didn't put ANYTHING in my PATH.  I had to add it myself.  My installation is in C:\MySql, so what I added to the PATH environment variable was "C:\MySQL\lib", as that is where the client DLL files were.  I also added "C:\MySQL\bin" for grins. 

" I set one up and the script ran flawlessly. "
Did you run the script from with in Mach4 ? as a Macro or regular .LUA script  ?

I ran the script from the Zerobrane editor.  Mach running, do the menu path Operator -> Open Script Editor.  Then open the file from my last post.  You can then step through the program line by line.  Hit F5 to start the program.  It will pause on the first line, then hit F10 to advance to the next line.  This is called single stepping.  Anyway, when it gets to the line where it "requires" the module step past that.  If you get an error there then that means luasql can't find the libmysql.dll dependency.  The error message is misleading.  It says that lua can't find luasql\mysql.dll in the specified directory.  However, if you look in that directory, it is indeed there.  So yes, that is misleading.  But that is more of a Windows thing than a LUA thing. 

I intend to call this with a MCode from a GCode script that our machinist wrote .

That will work.  I ran it from within the editor to test it.  But that code could be put into a macro script and it would be fine. 

I meant to ask about this line of code
package.path = package.path .. ";.\\Modules\\?.lua;"

It seems to be a generic folder  where we point to .Lua files could you give a quick what it is , and that syntax represents ??

Well.  those are the lines I added to the example on the luasql site.  That is the LUA equivalent of the PATH environment variable (package.path and package.cpath).  They are search directories.  So what those lines do is add our Modules directory to the directories that are searched when we try and load a module.  So lets examine the string that we appended:


";" is a path separator, just like what is used in the PATH environment variable. 
"." means "current directory".  This is used when we provide a relative path.  An absolute path could be used as well, such as "C:\\Mach4Hobby\\Modules\\?.lua".  But the relative path is used because we always have the Mach installation directory as the current working directory when launching scripts. 
"\\Modules\\" is the part of the path that points to the Modules directory.
"?.lua;" specifies the valid file extention. 

A lot of times you might do something like this:

package.path = package.path .. ";.\\Modules\\?.lua;.\\Modules\\?.mcs"

This will look for files with *.lua and *.mcs extentions. 

package.cpath will always need to look for *.dll files on Windows (*.so files on Linux). 

Anyway, look in your Mach installation's Modules directory to see what all we provide for extending LUA.  There are modules like luars232 for serial comms and luasockets for network comms, etc...


Mach4 General Discussion / Re: Super Simple Screen Set (Mach4 Beta)
« on: February 07, 2019, 11:00:09 PM »
How did you get the texture look on the buttons?

They are bitmaps used with the bitmap button control.  The bitmaps were created by the author of the screen, Graham. 


Mach4 General Discussion / Re: LUA, repeat until
« on: February 07, 2019, 08:54:58 PM »
The reason the OOB axes can't be controlled by G code is because there are no letters left in the G code language left to control them!!!  Think about it.  :)  ABCDEFGHIJKLMNOPQRSTUVWXYZ are all taken. 

UVW are the linear variants of ABC, if you were thinking that they could be used...

Also, mcJogIsJogging() may be interesting for this discussion. 


Mach4 General Discussion / Re: Sending Info to a Database from a Script
« on: February 07, 2019, 08:43:36 PM »
wxLua is LUA with bindings to the wxWidgets library.  You don't necessarily HAVE to use the wxWidgets bindings.  Just don't write code that uses anything with the "wx." prefix. 

The database should be doable.  We provide luasql for mySQL and ODBC.  However, neither will won't work by itself!  Database client software also needs to be installed.  For instance, if you installed an IBM DB2 client, it would install the ODBC driver.  For mySQL, the client files need to be installed on the machine, namely "libmysql.dll".  And these DLLs need to be in the PATH as well so that the luasql driver can find them.  Or copy them into the Mach4 installation folder.  But it is best to put their orignal location in the PATH environment variable though.

Attached is an example file from https://keplerproject.github.io/luasql/examples.html that I munged up to include our module paths.  It assumes that there is a database called "luasql-test" available that requires no password to access and alter.  I set one up and the script ran flawlessly. 

A mySQL database can also be accessed via ODBC with the following: https://dev.mysql.com/downloads/connector/odbc/  Install that and configure.  Then change the mysql specific stuff in that example file from myslq to odbc (lines 5 and 7). 


Mach4 General Discussion / Re: Mach4 LED's
« on: February 07, 2019, 07:48:12 PM »
All of the tools are there in the screen to implement what you want.  There is no LED in the wxWidgets framework.  So that "element" was custom coded.  This is different than buttons, as the wxWidgets framework implements stock Windows buttons.  In other words, a button on the Mach screen will look like a button in any other standard Windows application (that hasn't been dressed up).  The Terminal program Putty is a good example.  That being said, we allow the user to pretty much dress up any button they wish with the bitmap button and custom bitmaps.  My point is just because you don't see a screen element that does exactly what you want at first glance, don't assume that it can't be done. 

Back to the LEDs.  LED is an acronym for light emitting diode, as seen on many physical machine control panels.  And that is what I tried to make them look like.  Generally, people like the round LEDs because a round LED in Mach3 was not possible.  But sometimes a round LED is not what is needed or wanted, so there are properties in the control to set the shape.  You have a choice of round or square (rectangular, really).  But if you just plop a LED down on the screen in the screen editor, it is round by default and if no cursory glance at the properties is given, you may not realize that they can be made to be rectangular.  But either way, the LED screen element is rather graphical in nature under the hood.  Not textual.  It would not be easy to program it to ALSO be textual (although I'm thinking about it). 

BTW, there is a sticky topic in this forum titled "Mach 4 Feature Request".  I look at each and every post.  I don't respond in there very often, as it would consume my time that could otherwise be used to actually make the things happen.  If I think the idea has merit and I think that the majority of our user base could benefit from it, I'll implement it. 

But seeing as how text based LEDs do not exist at the present time, now it is time to start thinking outside of the box.  If I were to want a text based "Boolean" value (we won't call it an LED now), I'd start with a Static Text control and tie it to a register.  You can create a register in the regfile plugin's configuration.  Registers can contain text values, so basically whatever is put in that register will be what the Static Text control displays on the screen.  You can then tie the register's value to any signal in the signal script (or use the siglib) with a small bit of LUA code.  One could even change the color of what is displayed.  Yeah, it isn't as easy as plopping down a control and instantly having it appeal to your taste or sense of style, but it isn't THAT hard either. 

I'm not a young guy either.  And plenty on this forum know my thoughts on LUA.  Just to summarize them, I can't stand LUA.  We chose LUA not for it's looks, but because of it's speed and flexibility.  But I won't let that stand in my way of getting what I want.  :)

Here is an example of a screen set that looks NOTHING like our stock screens.  https://www.machsupport.com/forum/index.php?topic=35438.0


Mach4 General Discussion / Re: Mach4 build files infected?
« on: February 04, 2019, 05:09:05 PM »
When the anti-virus software becomes the virus...