Hi,
You can't do that with a g-code, but you can do that with an m-code, a macro.
You could write a macro with which you could execute a G31 probing code using the exec.Code("G31 Z-10"); code for example.
after that you could check the probed variables #5061 to #5066 for the probed axis coordinates.
You can also check the #5060 varibale value to see if the probing was successful or not. The possible values of this #var is described in the UCCNC manual.
And you could send messages to one plugin by plugin filename or to all plugins with the following functions:
Function: object Informplugin(string Pluginfilename, object Message)
Description: This function sends data to one plugin. The Pluginfilename parameter defines the name of the plugin to send the message to and the parameter is an object and the return value is also an object.
Example:
string teststr = "Hello Plugintest.dll...";
object Returnvalue = exec.Informplugin("Plugintest.dll", (object)teststr);
if (Returnvalue is string)
{
string str = Returnvalue as string;
MessageBox.Show(exec.mainform, "Return message was: " + str);
}
Function: void Informplugins(object Message)
Description: This function sends data to all plugins. The parameter is an object and there is no return value.
Example:
string teststr = "Hello to all plugins...";
exec.Informplugins((object)teststr);
The same function prototypes documentation together with the other available functions for plugins you may find in the UCCNC/Documentation folder.
With the Informplugin and Informplugins you can send a generic object to all plugins or to just your plugin and you can also pass an object back from your plugin as a return value.
Returning an object is only possible with the Informplugin function, the Informplugins function has a void return value, because that message is received by all plugins and so more may want to answer which could cause issues, so the Informplugins gives a one way communication only while the Informplugin which sends Message only to one, a named plugin that can be used to communicate 2 ways.
An object type (The message parameter) can be basicly anything, a string, a number, an array or whatever type you want to send.
You can catch the sent object in the plugin with the following function prototypes:
object Informplugin_event(object Message)
public void Informplugins_event(object Message)
And in your plugin you may check for type match of the sent object and then convert it, and the same way you can convert it in your macro, something like:
- Code: Select all
public object Informplugin_event(object Message)
{
if(Message is string)
{
string mystring = Message as string;
return (object)mystring;
}
return null;
}