Hello Guest it is September 23, 2023, 11:24:39 AM

Author Topic: Input c# using Mach4  (Read 2268 times)

0 Members and 1 Guest are viewing this topic.

Input c# using Mach4
« on: November 13, 2019, 09:02:13 AM »

I programm in c# but have some problems:
Connection works perfect get Axis and start them everything ok
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Mach4;
   int code = System.Runtime.InteropServices.Marshal.GetExceptionCode();
            txtXAxis.Text = _mInst.GetOEMDRO(800).ToString();
            txtYAxis.Text = _mInst.GetOEMDRO(801).ToString();

// List og OEMDRO https://www.cnc-steuerung.com/oem--buttons-code-liste-mach3-software.html

for Output I use _mInst.DoOEMButton(233); // to 238 that works

I want to read the Input State of Input 3-12 but i have no Idea how i can do this.

And how can I get the last error Message?

Thanks al lot.

Re: Input c# using Mach4
« Reply #1 on: November 14, 2019, 12:49:34 PM »
I see Tweakie has shifted this topic to the Mach4 General Discussion board but wonder if he was correct to do so.
Certainly the title of your post includes Mach4 and so logically it would be in the Machg4 board.

But the code fragments you posted are VB and are definitely Mach3 NOT Mach4 at all. The explanation may be that there is a file
called 'Mach4' in Mach3 installations and I believe it has to do with the incorporation of modules into Mach3. Is this what you

Either way can you confirm what installation you are using Mach3 OR Mach4?


'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Input c# using Mach4
« Reply #2 on: November 18, 2019, 03:43:10 PM »
do you mean you use the c# as API?
from yours c# application?

Offline smurph

  • *
  •  1,543 1,543
  • "That there... that's an RV."
    • View Profile
Re: Input c# using Mach4
« Reply #3 on: November 19, 2019, 02:50:16 PM »
Mach4, in this case, is referring to the OLE interface that Mach3 exports.  I don't know why it is called Mach4.  Anyway, there is a Mach4.tlb type library that is distributed with Mach3 that describes the interface.  I believe the IsActive() function is what you want to call.  With OEMTRIG1 to OEMTRIG15 as the constants to use as the function's parameter.  You will have to map the port and pins for each OEM Trigger that you use. 

So even though the OLE interface is named Mach4, this really is a Mach3 issue and it doesn't belong in the Mach4 discussion.

That is about all I know on the subject and I doubt there will be anymore information available.