Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: kccheng on April 09, 2019, 12:27:42 PM

Title: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 09, 2019, 12:27:42 PM
Hi,

I want to get eg. XYZ coord from Mach3; upload G code to Mach3, run G code ... etc.,  using C++. I found a example called "MachRemote" which can connect to Mach3 via an ActiveObject called "Mach4.Document".

I can run MachRemote now, but I don't know which APIs or commands I can use ?? From source code of MachRemote, I can find

    scripter.ActivateSignal()
    scripter.GetOEMLed()
    scripter.DoOEMButton()

Is there something like ... scripter.CycleStart() or scripter.Reset() ????

where can I get the complete list of exposed APIs from Mach4.Document ?
Thanks a lot.


Regards,
KC
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: MN300 on April 09, 2019, 01:53:34 PM
The API list should be in Mach4Hobby/Docs/Mach4CoreAPI.chm on your hard drive.
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 09, 2019, 03:14:35 PM
The API list should be in Mach4Hobby/Docs/Mach4CoreAPI.chm on your hard drive.

Yes, it's there ;-) Thanks.

KC
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 09, 2019, 03:30:54 PM
Hi,

I had looked at Mach4CoreAPI.  It's pure C/C++ APIs, but I don't think I can use them for Mach3 ???
For Mach3, I need APIs exposed by COM object "Mach4.Document" ???


Regards,
KC


The API list should be in Mach4Hobby/Docs/Mach4CoreAPI.chm on your hard drive.
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: reuelt on April 09, 2019, 05:32:28 PM
The following documents may be of assistance to you :

http://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf

http://www.machsupport.com/wp-content/uploads/2013/02/VBScript_Commands.pdf

http://www.machsupport.com/forum/index.php?action=dlattach;topic=9312.0;attach=6986

http://www.machsupport.com/forum/index.php?action=dlattach;topic=11056.0;attach=14194

http://www.machsupport.com/forum/index.php?action=dlattach;topic=11061.0;attach=14193

Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 09, 2019, 10:19:03 PM
Thanks

In fact, I had all these documents, and I had quick read of them before I ask question here.
These documents do help, but none of them mentioned about COM and "Mach4.Document".

The only information I found is the "MachRemote" example and one modified from MachRemote
which compiled by mingw and can upload G-code to Mach3.

After a lot of google search ... I think there is no official document for COM, hopefully I'm wrong.

Regards,
KC
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: joeaverage on April 09, 2019, 10:26:17 PM
Hi,
as you probably know all Mach3 development ceased five years ago. If documentation is not available now it never
will be.

Mach4 on the other is current and developing. If you have a specific project and sign an NDA (non disclosure agreement)
with NFS then you would get ALL the inside gen on Mach4.

Craig
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 09, 2019, 10:43:33 PM
That's helpful, Thanks
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: reuelt on April 09, 2019, 11:24:31 PM
You just need to import these registry entries into Windows
(Administrator rights required)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Mach4.Document]
@="Mach4.Document"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Mach4.Document\CLSID]
@="{CA7992B2-2653-4342-8061-D7D385C07809}"


Copy & save into a text file say regentry.reg

start| run
Regedit
Import regentry.reg

Close
reboot PC
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 09, 2019, 11:32:18 PM
Thanks for reply.

I did have these KEY in registry.  In fact, my copy of MachRemote working perfectly. 
It can connect to Mach3 and Reset Mach3.

My question is where is the complete list of available APIs exposed from COM object (Active Object) "Mach4.Document".


You just need to import these registry entries into Windows
(Administrator rights required)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Mach4.Document]
@="Mach4.Document"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Mach4.Document\CLSID]
@="{CA7992B2-2653-4342-8061-D7D385C07809}"


Copy & save into a text file say regentry.reg

start| run
Regedit
Import regentry.reg

Close
reboot PC
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: rhtuttle on April 10, 2019, 12:29:39 PM
It's been many years since I developed my Mach3 COM wrapper.  I was using Delphi which is object pascal.

https://www.machsupport.com/forum/index.php?topic=32144.0 (https://www.machsupport.com/forum/index.php?topic=32144.0)

 I have attached another pascal file (renamed .txt for upload).  I think you could rewrite it to C++ fairly easily.


HTH

RT
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: kccheng on April 10, 2019, 09:47:07 PM
Hi RT

Thanks for the example.  I give up looking for official Mach3 COM programming manual,
but your example is more than enough !! That's big help.

Thanks a lot
KC

It's been many years since I developed my Mach3 COM wrapper.  I was using Delphi which is object pascal.

https://www.machsupport.com/forum/index.php?topic=32144.0 (https://www.machsupport.com/forum/index.php?topic=32144.0)

 I have attached another pascal file (renamed .txt for upload).  I think you could rewrite it to C++ fairly easily.


HTH

RT
Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: TPS on April 11, 2019, 02:53:47 PM
i think CMyScriptObject.h file from machremote example is also a good reference

Title: Re: Mach3: Expose APIs from Mach4.Document
Post by: djmickyg on August 17, 2020, 07:55:18 PM
I can run MachRemote now, but I don't know which APIs or commands I can use ?? From source code of MachRemote, I can find

hi kccheng, did you ever find a list of usable functions?
i'm creating a python connector, I've got the following functions to work. I cant get doOEMbutton or GetOEMLed to work.

LoadGCodeFile('C:\Mach3\GCode\cross.tap')
cyclestart()
closefile()
shutdown()
SetFRO(100) #feedrate override, send percent