3

I want to connect to an OKUMA Windows based control from external PC (i.e. Other than OKUMA controller) and utilize the OKUMA Open API on that machine. Is it possible? (If yes then How?)

Below is my code which I want to run from my laptop to check machine running mode. I'm getting errors because Okuma.CLDATAPI can't run on my local PC :

using Okuma.CLDATAPI.Enumerations; // Part of the API on the machine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OKUMA_TRIAL
{
    public partial class Form1 : Form
    {
        Okuma.CLDATAPI.DataAPI.CMachine objCMachine;
        public Form1()
        {
            InitializeComponent();

            objCMachine = new Okuma.CLDATAPI.DataAPI.CMachine();
            objCMachine.Init();
        }

        private ExecutionModeEnum fnGetRunMode()
        {
            return objCMachine.GetExecutionMode();
        }

        private void btnRead_Click(object sender, EventArgs e)
        {
            txtRunMode.Text = fnGetRunMode().ToString();
        }
    }
}

If this isn't possible, is there another way to communicate with the machine?

StuartLC
  • 104,537
  • 17
  • 209
  • 285
  • Welcome to Stack Overflow! It would be *much* easier to help you if you could show us [what you've tried](https://stackoverflow.com/help/mcve). Also, while we're at it, check out [how to ask](https://stackoverflow.com/help/how-to-ask) and [what's considered on-topic here](https://stackoverflow.com/help/on-topic). – Claudia Feb 05 '18 at 06:06
  • 1
    Great question! I’ve done this before by creating a WCF wrapper for the Okuma API functions I’m using and managing the connections via that. If this gets opened back up so a real answer can be posted, there are lots of people who can help. – Still.Tony Feb 05 '18 at 22:06
  • 1
    As @Still.Tony mentioned, you can create your own wrapper that makes API calls available on the machine. You can not use the API libraries directly on a PC (unless that PC thinks it is a machine, as in a PC NC-Master). In your case, to get machine operation state people typically use [MT Connect](https://www.myokuma.com/mtconnect-agent-adapter). – Scott Solmer Feb 13 '18 at 21:11
  • @Still.Tony, can you provide us an example of your wrapper? Thanks! – Niv Navick Sep 10 '18 at 14:34
  • @NivNavick I haven't touched it in ages and no longer have that source code. I think the experts are at IMTS right now but I'll see if I can get one to post an answer on here. – Still.Tony Sep 11 '18 at 00:59
  • @Still.Tony . Basically I need to write my own web service and install it on the window based Okuma machine ?How do I keep it running when the manufacturing software is running ? – Niv Navick Sep 11 '18 at 22:02

1 Answers1

0

Use Windows Communication Foundation to wrap the API.

Due to popular demand, the Open API SDK now includes a WCF client / service example.

WCF Example Service and Client

It is important to note that we do not feel comfortable releasing code of a publicly available service with API access, so this example is configured for local-host only. Of course it is trivial to change the configuration, but whomever does so needs to accept all responsibility for doing so.

Microsoft has actually done a good job of documenting WCF features, see below.


Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4

Scott Solmer
  • 3,871
  • 6
  • 44
  • 72