Hello Guest it is April 28, 2024, 07:56:33 AM

Author Topic: GetDRO / SetDRO from a plugin  (Read 11666 times)

0 Members and 1 Guest are viewing this topic.

GetDRO / SetDRO from a plugin
« on: September 12, 2006, 07:50:24 PM »
Heloo,

I have started working with the plugin SDK.  The plugin I want to write will interact with the Mach3 DROs and buttons.  My first attempt at modifying the blank plugin cannot read or write the DROs using the codes in the Mach2 customization manual (0, 1, 2) for DROs X, Y, and Z.  The Wiki says GetDRO / Set DRO is deprecated for the VB scripting.  I have implmented a simple GetDRO and a SetDRO in the myConfig method.  Nothing happens when I press the 'config' button on the plugin config screen.

-James Leonard
Re: GetDRO / SetDRO from a plugin
« Reply #1 on: September 14, 2006, 03:46:55 AM »
To answer my own question, what has been implemented is GetOemDRO and SetOemDRO.  The codes from the wiki work fine

-James
Re: GetDRO / SetDRO from a plugin
« Reply #2 on: April 30, 2009, 03:19:32 AM »
Hello,
I have encountered similar problem to this and i am posting the record of my conversation w jemmyell:

ME:

Hello
I have came across your problem with SetDRO when developing plugin for mach (here;s the link: http://www.machsupport.com/forum/index.php/topic,1339.0.html). I have similar situation. I cannot touch dro's in my plugin because setdro doesn't seem to have any effect and getDro always returns value of 0.1 . I want to ask you, how have you solved your issue? i.ve tried to rename the function but should it work ? i mean we only instantiate the pointers to the functions and then call this pointers but does the name of the pointer matter? I would very appreciate your help.
Regards

JEMMYELL:
Quote
Hi, at that same link you can see that I posted to use SetOemDro and GetOemDro.  The DRO's that Mach3 uses CANNOT be set.  You must change the values that they reflect.  You CAN get the values of these DROs.  See my tutorial plugin for header files with all the right values.

ME:
Hi,
Thank you very much for your quick reply. After two hrs of digging through forum i've finally found SetOEMDRO in scripter class in the tutorial you've provided ( on which i try to build my plugin). However i still cannot read any dros via this (get...) function. It returns -INF ( for int -217...) which i think to be some kind of error value for double values when eg overflows occur, so after conversion to int i got -217.... I also got the dbg message " Warning: attempt to call Invoke with NULL m_lpDispatch!" when executing these functions. I execute them : scripter.SetOEMDRO(X_DRO,12); (int)scripter.GetOEMDRO(X_DRO); /*i know that it returns double*/ I am now rather desperate. One more thing. Since i cannot set dros which mach uses, should i add to my screen my own dros (with functions i want control) and only then i will be able to control them by scripter.SetOEMDRO(X_DRO,12);  or scripter.SetOEMDRO(X_DRO + 1000,12); ?
Thank you very much for your help. I hope that you will   be able to understand my thought which hides under my english

Best Regards,
Maciek

I found on the net that i need to call  scripter.CreateDispatch("progNameOrSmth"); but it returns 0 and i still have the warning. Any ideas ?

Maciek

JEMMYELL:
Quote
Get the ZIP file from reply #41 in this thread.  It's all in there.

http://www.machsupport.com/forum/index.php/topic,4884.40.html

You should really ask these questions on the forum so all can benefit.



OK, the problem is you need to call  SetOEMDRO from CMyScriptObject class, but before that  you must call Mach3ObjectModelStartup() so that it could work. At the exit you call Mach3ObjectModelShutdown(). That was all in the newest version of the plugin from #41 reply, but i have overlooked it in my version 1.b. Thanks again Jemmyell. now everything works fine.
Re: GetDRO / SetDRO from a plugin
« Reply #3 on: April 30, 2009, 02:05:52 PM »
You are welcome.  I am always glad to help.

-James