Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 10:29:54 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Mach SDK plugin questions and answers.
| | |-+  Pluging and Macro interaction?
Pages: 1 2 »   Go Down
Print
Author Topic: Pluging and Macro interaction?  (Read 1350 times)
0 Members and 1 Guest are viewing this topic.
Matty Zee
Active Member

Offline Offline

Posts: 38


View Profile
« on: October 26, 2009, 06:27:35 PM »

Hi,

I've just started writing a plugin and everythig is going well so far. I understand how i can implement most of my requirements in my plugin but one thing has me stumped. Can Macros call functions that i write as part of my pluging?
For example, if i write a class in my plugin to talk to a serial port device and poll it during the 'update()' call. But then if i want a specific message to be sent to the device on say and spindle start/stop (M30/M31?) how do i do that? Can i put a function call to my plugin in the M31 Macro? but one is a VB script the other C++ library.

Cheers
MattyZee
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #1 on: October 27, 2009, 07:12:50 PM »

Yes, you can send numeric messages from VB to your Plugin. 
 
Lets say you want to send the number 6000, and when your plugin gets that number in the MyNotify section you do what ever with it.

in VB you send:  "NotifyPlugins(6000)"   (without the quotes).

scott
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Matty Zee
Active Member

Offline Offline

Posts: 38


View Profile
« Reply #2 on: October 28, 2009, 07:29:53 AM »

Thanks for the reply scott.

So how does my plugin know that message is for it? What happens if i send a NotifyPlugins(x) where x is a number another pluging uses?
Logged
Steffen_Engel
Active Member

Offline Offline

Posts: 29

Chattanooga, TN, USA


View Profile
« Reply #3 on: November 09, 2009, 09:50:54 AM »

Hi Matty,

there is another way to call functions in Plugins: you can export DLL-Functions and call them from VB.
it has the advantage to calling your plugin in a private way without a broadcast to all plugins like NotifyPlugins

As an Example:

in your DLL (the plugin) you have a function

Code:
EXTERN_C DLLEXPORT void MyPluginFunction (long Parameter1, long parameter2)
{
  // Do what you want
}

Then in a script with VB from Mach3 you can call it the following way:

Code:
Declare Sub MyPluginFunction  Lib "PlugInName" (ByVal Parameter1 As Long, ByVal Parameter2 As Long)
Call MyPluginFunction (1, 2)

Bye, Steffen
Logged
mjtooba
Active Member

Offline Offline

Posts: 6


View Profile
« Reply #4 on: December 20, 2009, 02:05:50 PM »

hi,how we can execute mach3 script via plugin ?
stored script in my plugin code or my settings (xml).
i want to execute various script in my plugin without using any macro code or any thing else, just running script like macropump.
Logged
Steffen_Engel
Active Member

Offline Offline

Posts: 29

Chattanooga, TN, USA


View Profile
« Reply #5 on: December 22, 2009, 12:23:43 AM »

Code in your Plugion is just a Plugin-Code.
All Functions available in Mach3-VBA are available to the plugin in the Mach3-Interface.


External calls to Macros in the xml I don't know.

Bye, Steffen
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #6 on: December 22, 2009, 11:30:50 AM »

If you want to run a "Macro" from the plugin, then in your C code when ever the condition is met to run it have this line:

   Code("M888");  // where "888.m1s" is your macro number that has the code you want to execute.

Inside Mach MAD plugin, I have a dialog window that allows you to type in and "run VB", to Mach 3, but it is really for Diagnostics/testing.

like Steffen said above, you can do all mach functions from within the plugin though.

scott
« Last Edit: December 23, 2009, 01:10:44 PM by poppabear » Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
mjtooba
Active Member

Offline Offline

Posts: 6


View Profile
« Reply #7 on: December 23, 2009, 01:26:50 AM »

ok
thanks,i trying to implement Code(M*********) but i can't used "code(M*********)" function in VBA during CNC running a program,i think when cnc is running ,any M Code must be executed via RS274 interpreter ? it is true. or its my fault.

i interested "run VB" like mechanism that able to run simple "VB" script in my plugin and can be edited via plugin.i found script header and class declaration in "include" folder but not yet using that.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #8 on: December 23, 2009, 01:13:04 PM »

I am sorry, but I really dont understand what you want......... or what exactly your saying.
This is NOT meant as an insult in any way, but is there a friend of yours who could put your questions
into better English so I could understand what your asking?

scott
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
mjtooba
Active Member

Offline Offline

Posts: 6


View Profile
« Reply #9 on: December 23, 2009, 02:04:21 PM »

i want to use VBA in my plugin.
how to access VBA interpreter class and objects ?

i can't use code(""); function.
Logged
Pages: 1 2 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!