OK I got the XML bit figured out. It turns out that the XML writing merely needs to be done in the piStopPlug routine is all. This is actually documented in the Mach Plugin Wizard. So I've just about go the plugin finished now. The parsing routine is done and everything is ready to go, except one thing, and I could REALLY use some help with this.
All I want to do is simply tell Mach to load the new gcode file I've created from the parsing. In other words, the plugin writes a new g-code file to disk and i just need the plugin to tell Mach to load the file. I am, of course, able to access all of the Mach variables in
MainPlanner and
MachView, etc.
However, I am unable to invoke any of the functions such as those in
rs274ngc.h. For example, the following code appears in my
piNotify() routine:
rs274ngc_open(fileNm);
Where fileNm is prperly set as the file name and path (a LPCTSTR). If I compile and build this, it appears to
compile fine, but then I get a linking errors:
Error 1 error LNK2028: unresolved token (0A000013) "int __cdecl
rs274ngc_open(char const *)" (?rs274ngc_open@@$$FYAHPBD@Z) referenced in
function __catch$?piNotify@@$$FYAXH@Z$0
C:\Users\usrnm\Desktop\tmp\plgn\Plugin.obj
Error 2 error LNK2019: unresolved external symbol "int __cdecl
rs274ngc_open(char const *)" (?rs274ngc_open@@$$FYAHPBD@Z) referenced in
function __catch$?piNotify@@$$FYAXH@Z$0
C:\Users\usrnm\Desktop\tmp\plgn\Plugin.obj
Error 3 error LNK1120: 2 unresolved externals
C:\Users\usrnm\Desktop\tmp\plgn\Debug\MultiZ.dll
I am about to pull out all of my hairs! I spent most of the day yesterday trying to figure this out but still haven't gotten there. I can't figure out how to make it work...
I also tried using the "scripter" functions available in Mach. I added a reference to
Mach3.exe in my project which gave me access to the Mach4 namespace and the
IMach4 class. I have tried the following:
Mach4::IMach4^ mch = (Mach4::IMach4^) System::Runtime::InteropServices::Marshal::GetActiveObject("Mach4.Document");
Mach4::IMyScriptObject^ scripter = (Mach4::IMyScriptObject^) mch->GetScriptDispatch();
Well that compiles OK but it crashes Mach upon startup. I get "Error found, Art code: 1 - attempt recovery" and "Error Triggered" and Error Stopping Timer" notices upon starting Mach.
All I really want to do is to provide Mach with a string to the file path and just tell mach to load the g-code file! I'd really apprecaite any help anyone can offer - I'm about to lose it!
