Hello Guest it is March 28, 2024, 04:20:05 PM

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

1151
Mach4 General Discussion / Re: DRO Code differences
« on: April 28, 2014, 08:13:22 PM »
Is G68 not working?  Can you give an example?

Steve

1152
Mach4 General Discussion / Re: Comments about Mach4 in Demo
« on: April 28, 2014, 04:35:14 PM »
If writing a plugin or a third party app, yes.  Contact Todd Monto.  You might want to get things rolling.  However, we won't release the API until all of the documentation is done.

Steve

1153
Mach4 General Discussion / Re: Comments about Mach4 in Demo
« on: April 28, 2014, 12:44:47 PM »
Is it going to be possible to remotely access and control Mach4 as I could with Mach3 using third party software such as:
Mach = (Mach4.IMach4)Marshal.GetActiveObject("Mach4.Document");
Script = (Mach4.IMyScriptObject)Mach.GetScriptDispatch();

Then using script.Code(Gcode);  to send the command to Mach4 to move the steppers etc.
I have tried this with the Mach4 demo but it wont connect or respond.

There is no DCOM interface.  Mach4 is cross platform and we had to choose a way of doing the remote stuff that is also cross platform.  There is a library that you will link to in order to accomplish this.  The full API is exposed.  Running scripts, etc...

Steve

1154
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 10:36:27 PM »
A function is not a loop.  And not all loops are bad.  You just have to make sure that the loop will not loop for a long time (or forever).  But functions are a great idea.  Take a look at the Screen Load script.  That is where I put functions that are used by the PLC script.  So put your getAngle() function there and call it from the PLC script.

Steve

1155
Mach4 General Discussion / Re: Comments about Mach4 in Demo
« on: April 27, 2014, 09:03:40 PM »
I forgot to mention that the DROs highlight with a double click. 

Steve

1156
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 08:19:13 PM »
The net does not have our API calls.  The documentation is in progress but it is a LOT of slow tedious work.

Here is a quick look at the screen API call available to LUA inside the Mach4GUI:

(All functions return a result code as their first return value.  0 == success)

number scr.ShowPage(string pageName); -- Show a screen page by name.
number, string scr.GetProperty(string ctrlName, string propName); -- Get a control's property value.
number scr.SetProperty(string NctrlName, string propame, string value); -- Set a control's property value.
number scr.ExecMdi(string ctrlName); -- Execute the contents of a named MDI control.
number, number scr.GetCurrentPage(); -- Get the current page.
number, number scr.IsControl(string ctrlName); -- Is this a valid control?
number, number scr.IsProperty(string ctrlName, string propName); -- Is this a valid control and property combination?
number scr.ButtonClick(string ctrlName); -- Simulate a button click event.
number scr.ButtonUp(string ctrlName); -- Simulate a button up event.
number scr.ButtonDown(string ctrlName); -- Simulate a button down event.

A word of warning...  DO NOT use loops in the PLC script.  It is a script that is designed to be executed like a PLC; top down.  The frequency of the script can be set in the screen set properties.  There is a lot of power here.  But with power comes great responsibility because it has the ability to completely ruin your day if you are careless!  There is nothing preventing you from adding loops or setting the PLC script to run every 1 millisecond.  It will happily let you do these things with a smile.  So be careful!

Steve

1157
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 03:35:40 PM »
number SetProperty(string ctrlName, string propName, string newValue)

The function is int the "scr" table.

scr.SetProperty('droXy', 'Value', tostring(XYval));

All parameters are strings.  So you have to convert the XYVal into a string with tostring().  Now, this does not control the format of the DRO.  That is done with the Format property that should already be set.

Any property of any control can be set this way.  The property names for the controls are what are used in the properties grid in the editor.  There is no documentation that lists the properties of each control yet.  Just look at them in the properties grid and use what you want.

As I said, look to the PLC script as an example of this function where we make the Enable button blink.

Hint:  Where there is SetProperty(), there is also a GetProperty() making it possible to read the properties of any control.

Steve

1158
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 02:25:15 PM »
A lot of those images were from my computer which had a HD crash.  I just imported all of them and didn't look at each one.  So it is basically a corrupt image that was imported into the screen set.

I guess I don't understand your other issues.  You simply add images to the screen set via "Manage Images".  Then, you create a bitmap button and choose the image that you imported in the Image property drop down list.  LUA has nothing to do with it.  

The LUA comment was on how to update a DRO with a calculated value.  There is a screen objects API that is used.  I do not have it documented yet.  But you can see some of it in action just by looking at the scripts behind some of the buttons and the PLC script.  It is how we make the enable button blink, etc...

Steve

1159
Mach4 General Discussion / Re: Comments about Mach4 in Demo
« on: April 27, 2014, 01:50:50 PM »
Hi Brian,

Are you taking notes of the comments and reports, or are they getting consistently missed...? What's the purpose of this thread then anyway? Would be nice of you (or Steve) could confirm that a comment posted has been noted.

Dan

Sometimes I don't get the reply notifications from the forum.  I'm reading this thread today for the first time since I last posted to it, so I really haven't had time to ACK every post.  Just put the items/comments in here and we will see them.

As to your points about the Soft Limits click issue and the DRO entry, consider them duly noted.

Steve

1160
Mach4 General Discussion / Re: DRO Code differences
« on: April 27, 2014, 01:26:44 PM »
All GUI objects can be accessed by their name in the LUA script environment.  This can be done as a result of an event (button press, etc...) or part of the PLC script.  The PLC script take the place of macro pumps and brains.

When in the screen editor, Screen->Manage Images.  This is where you add images to your screen set.  Then those images will appear in the Images drop down list.

Steve