Hello Guest it is March 28, 2024, 09:11:08 AM

Author Topic: Mach3 Plugin Tutorial Document and Prototype File Set  (Read 139673 times)

0 Members and 1 Guest are viewing this topic.

Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #20 on: January 18, 2008, 12:14:58 PM »
Hi Jean Pierre,

If yu mean the C++ language functions please look at the tutorial sites in my document.  If you mean the Mach3 Object Model functions there is a header file (.h) that is created that shows the function definitions.  You can cross refernce this with the VB script (Cypress Enable VBA) functions that are used to write Mach3 macros.  They are the same functions.

-James

Offline jp

*
  •  2 2
    • View Profile
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #21 on: January 18, 2008, 01:22:49 PM »

Hello James,


Many thanks for your answer, I will read carefully your tutorial and post another questions if needed !


Best regards,

Jean - Pierre
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #22 on: February 15, 2008, 10:25:02 PM »
If there is sufficient interest I will make this a series.
-James Leonard

This tutorial has been a tremendous aid.  Thanks for sharing!
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #23 on: April 07, 2008, 07:25:06 AM »
I'm a vb6/sql server programmer and I'm trying to complete this tutorial using vs2005 -> it will be interesting.
Until now it seems to compile with few warnings about some deprecated functions.

In the plugin zip archive I can't find the ‘proto.rc2’ and the res folder.
If is somewone to send it to me or tell me with what I could replace it I would thank you very much.

Trying to compile the example in the file CustomPluginImpl.cpp at function :

CString   myProfileInit(CString name, CXMLProfile *DevProf)   

{
   DbgMsg(("myProfileInit entry"));

   //this gets the default directory DefDir in which Mach3 is located.  and the profile name ex. "Mach3Mill"
   //DefDir = DevProf->GetProfileString("Preferences","DefDir","C:\\Mach3\\");
    //Profile = DevProf->GetProfileString("Preferences","Profile","Mach3Mill");

   DbgMsg(("myProfileInit exit"));
   
    return(" CustomPlugin PlugIn - James W. Leonard Ver 1.0 ");
}

I receive the following error at return line:
Error   8   error C2664: 'ATL::CStringT<BaseType,StringTraits>::CStringT(const VARIANT &)' : cannot convert parameter 1 from 'const char [48]' to 'const VARIANT &'   d:\daniel\dotnet\machsdk\sdk\customplugin\customplugin\custompluginimpl.cpp   63   

I have tryed a lot of explicit conversions but without success.

« Last Edit: April 07, 2008, 10:18:00 AM by dandumit »
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #24 on: April 07, 2008, 11:42:02 AM »
I'm a vb6/sql server programmer and I'm trying to complete this tutorial using vs2005 -> it will be interesting.
Until now it seems to compile with few warnings about some deprecated functions.

In the plugin zip archive I can't find the ‘proto.rc2’ and the res folder.
If is somewone to send it to me or tell me with what I could replace it I would thank you very much.

Trying to compile the example in the file CustomPluginImpl.cpp at function :

CString   myProfileInit(CString name, CXMLProfile *DevProf)   

{
   DbgMsg(("myProfileInit entry"));

   //this gets the default directory DefDir in which Mach3 is located. and the profile name ex. "Mach3Mill"
   //DefDir = DevProf->GetProfileString("Preferences","DefDir","C:\\Mach3\\");
 //Profile = DevProf->GetProfileString("Preferences","Profile","Mach3Mill");

   DbgMsg(("myProfileInit exit"));
 
 return(" CustomPlugin PlugIn - James W. Leonard Ver 1.0 ");
}

I receive the following error at return line:
Error   8   error C2664: 'ATL::CStringT<BaseType,StringTraits>::CStringT(const VARIANT &)' : cannot convert parameter 1 from 'const char [48]' to 'const VARIANT &'   d:\daniel\dotnet\machsdk\sdk\customplugin\customplugin\custompluginimpl.cpp   63   

I have tryed a lot of explicit conversions but without success.



Hello,

Nobody has actually succeeded with VC++ 2005 as far as I know.  The issue is one of the 'breaking changes' is causing the data block pointers coming from Mach3 to be wrong somehow.  I suspect the change from ANSI to UNICODE strings causing the data structures to be different sizes and of course thowing off the pointers.

The compile error you're getting looks like you started the project as an ATL component.  It is intended to be a MFC DLL.  If you want to use ATL for your own purposes I would suggest just making a plain vanilla plugin first so you can be sure to have all the mechanics under control.

If you start the project as a MFC DLL the res folder and rc2 file will be created by the wizard.

You really need to use VC++ 2003 in the short term.  MAYBE other compilers can be used, but they are a research project.

-James Leonard
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #25 on: April 09, 2008, 01:45:55 PM »
First of all THANK YOU James for this tutorial ! - it's a great help (personally I find it too basic but for others it's probably perfect).
I'm anxious to receive your next level tutorial ! I didn't used c++ since college - so I'm a beginner too - and in Visual Studio 2003 works smooth indeed.

I have downloaded the latest SDK : Mach3SDK Version 2.62 and I figured out that are needed  few changes until now :

James is very busy now and I hope that someone else who's good at plugins development and it will help.

in // Mach3ObjectModel.cpp
   //scripter.DoOEMButton(CLOSE_GCODE);
   scripter.DoOEMButton(CLOSE_GCODE_FILE);

At the beginning of // Mach3ObjectModel.cpp  I have added : #include "Mach3Button.h"

But I still receive a few errors. This is strange because I can't figure why are appearing because all the objects are instantiated and needed h files included.
I suppose too like James it's sugesting that the 'scripter' object isn't instantiated (even if it is declared at beginning).

c:\cnc\Mach3Development\SDK\CustomPlugin\PluginTestDlg.cpp(62): error C3861: 'DoButton': identifier not found, even with argument-dependent lookup
c:\cnc\Mach3Development\SDK\CustomPlugin\PluginTestDlg.cpp(67): error C2065: 'scripter' : undeclared identifier
c:\cnc\Mach3Development\SDK\CustomPlugin\PluginTestDlg.cpp(67): error C2228: left of '.LoadFile' must have class/struct/union type
c:\cnc\Mach3Development\SDK\CustomPlugin\PluginTestDlg.cpp(72): error C3861: 'DoButton': identifier not found, even with argument-dependent lookup
c:\cnc\Mach3Development\SDK\MachIncludes\Mach4View.h(18): warning C4192: automatically excluding 'IServiceProvider' while importing type library 'ShockwaveFlash.ShockwaveFlash'
c:\cnc\Mach3Development\SDK\CustomPlugin\CustomPlugin.cpp(230): error C2065: 'DoButton' : undeclared identifier
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #26 on: April 09, 2008, 04:24:58 PM »
Hi Daniel,

Why don't you ZIP up your project and post it here?  That way I could give it a quick try with the version of the SDK that I wrote this tutorial on.

That is the first test.  Also, it will be MUCH easier to debug and comment on if we have the complete project.

-James Leonard
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #27 on: April 10, 2008, 01:00:23 AM »
here is the archive. I have figured  out why it wasn't recognizing the scripter object (it wasn't declared into plugintestdlg file too)
it still doesn't compile and doesn't find the correct reference to DoButton function.

any help is greatly appreciated
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #28 on: April 10, 2008, 02:28:42 PM »
Hi Daniel,

My apologies for the omissions.  I found notes in my last version of CustomPlugin on my laptop.  They said I need to update the prototype file set...

I have posted the revised PluginProto_V01b.zip on pafe one and I am posting a repaired project for you here.  This is what I had to do:

PluginTestDlg.cpp:
added 'extern' to CMyScriptObject scripter declaration: I.E.
extern CMyScriptObject scripter

CustomPlugin.h:
Added these declarations:

typedef void (_cdecl *DoubleShortDouble) ( short , double );

extern OneShort           DoButton;     // void DoButton(code)
extern DoubleShort        GetDRO;       // Double GetDRO(code)
extern DoubleShortDouble  SetDRO;       // void SetDRO(short code, double value);
extern BoolShort          GetLED;       // bool GetLED(short code);
extern CSTRret            GetProName;   // CString GetProName()
extern VoidLPCSTR         Code;         // void Code("G0X10Y10");

The missing declaration were causing your link failure, but without the 'extern' on your scripter declaration things would have been funny anyways.

-James Leonard
Re: Mach3 Plugin Tutorial Document and Prototype File Set
« Reply #29 on: April 15, 2008, 11:05:32 AM »
Hello James,
Now the project compiles like a charm. One single warning :   c:\cnc\Mach3Development\SDK\MachIncludes\Mach4View.h(18) : warning C4192: automatically excluding 'IServiceProvider' while importing type library 'ShockwaveFlash.ShockwaveFlash'.

I'm running VS2003 sp1 on WinXp with latest Mach3SDK Version 2.62.

I still have one single issue : the following doesn't want to do what it has to do :
void CPluginTestDlg::OnBnClickedLoadRr()
{
   DbgMsg(("OnBnClickedLoadRr entry"));
   //scripter.LoadFile((LPCSTR)"C:\\Mach3\\GCode\\roadrunner.tap");
   scripter.LoadFile("C:\\Mach3\\GCode\\roadrunner.tap");
   DbgMsg(("OnBnClickedLoadRr exit"));
}

The message from debug view :
[492] OnBnClickedLoadRr entry
[492] Warning: attempt to call Invoke with NULL m_lpDispatch!
[492] OnBnClickedLoadRr exit

I have double and triple check the path and if the file exists. it doesn't want to go.

Also it could be a great ideea if you would teach us how to run the dll in debug mode in VS.

kind regards
Daniel