An MTConnect Command-Line Client

An MTConnect Command-Line Client

As a weekend project, I put together a command-line MTConnect client. It’s coded in C# for .NET 5.0, and I’ve published the source code on GitHub. It’s still a little rough around the edges, but here’s a quick look.

Testing whether an MTConnect Agent is running at a given URL. At agent.mtconnect.org, yes. At google.com, no.

One use for a command-line client might be for easily checking whether an MTConnect agent is running at a given address. The test just runs a probe and checks whether an MTConnectDevicesDocument is returned.

Obviously the error message is not great, but OK means ok, and Error means not ok.

(Part of the check didn’t make it into the initial release, but the client should still identify a webserver serving non-XML data as not being an MTConnect agent. This’ll be fixed in the next release.)

Displaying current condition dataItems from the agent.

Another use might be to easily feed data to stdout for scripting purposes. The client will output the entirety of a “Current” or “Sample” MTConnectStreamsDocument by default. Output can be configured for XML or JSON.

It can also be configured to filter dataItems by id, name, category, type, and/or subtype. In this case, the client will output a list of dataItems that match the filter. Output can be configured for XML, JSON, or CSV.

(Ok, the CSV output is pretty broken. It doesn’t include column headers. It doesn’t include condition. It doesn’t deal with escaping commas etc.)

Doing some things in interactive mode.

If no commands are passed on the command-line, the client will start interactive mode. Enter a command at the > prompt, and it will be run immediately. The screenshot above shows outputting a particular dataItem as XML or JSON, displaying help, and outputting a probe request.

I’ll update this client as time permits and whenever I notice bugs. If you’re interested in seeing features (or notice bugs that I’ve missed) please contact me here or on GitHub.

Okuma SCOUT

Okuma SCOUT

This is an update of an article about how to determine the installed version of THINC API. Back then, the method for checking the installed version involved searching the Windows Registry’s uninstall information for a specific GUID key.

Eight years have passed since then. Now there’s a utility library called SCOUT (System Compatibility Output UTility) that provides an easy way to read the installed THINC API version, and much more.

The library (and its provided sample application) shows whether THINC API is installed, what version and type, whether the API is ready, along with:

  • Special CNC directories (OSP, CNS, VOLANTE, CRAD)
  • Data Management Card (DMC) info
  • License status for Data and Command API, P200, NC Current Alarm, and other common specs
  • Installed .NET Framework versions (although this is a .NET library, so chicken-and-egg)
  • Basic OS information (Windows version, internet access, machine name and domain, user name etc.)
Okuma SCOUT Test Application running on my local machine. THINC API obviously is not installed.

The Okuma SCOUT library is an indispensable tool for THINC developers whose apps need to learn about their CNC environment programmatically.

For users who just need a convenient tool to check THINC API version and Data Management Card information, the Okuma SCOUT App provides both a command-line and a GUI tool for doing so.

THINC App: Panel Mode

THINC App: Panel Mode

Let’s code a panel mode switcher application for Okuma THINC! An app that lets you switch panel mode from a VNC or other remote desktop application.

Wait, but why? After all, there’s already a panel mode application on the Okuma App Store, and it works quite sufficiently.

Just about every THINC developer has, at some point, coded a panel mode app. It’s the THINC equivalent of “Hello, world!” And since it’s been eight years since I last wrote about it, now’s a good time to look at how THINC app development has changed.

A panel mode switching THINC app.

Read More Read More

7 Basic Tips for THINC Apps

7 Basic Tips for THINC Apps

What to do (and what not to do) in your THINC App.

So you’re developing a THINC application to run on your Okuma THINC CNC. You’ve read the fine documentation in the Okuma Open API SDK, right?

If you’re new to THINC, and you haven’t yet read the documentation, you might have missed out on some helpful tips. So to get you started, here are seven very basic tips for THINC app development.

Read More Read More

AWS Machine Monitoring

AWS Machine Monitoring

Although I no longer work in machining, I still follow news from the industry. This evening I was surprised to see an article on Ars Technica entitled Amazon to roll out tools to monitor factory workers and machines.

Is Amazon getting into the machine monitoring business?

Not in the sense of providing a CNC machine monitoring solution.

Amazon is introducing two new services for AWS (Amazon Web Services). These services, named Panorama and Monitron, use web-connected sensors installed in a facility to feed data back to an appliance or to the AWS cloud, respectively, so that ML (machine learning) can do its magic.

Keeping in mind that I have not touched either of these services, and that my knowledge of them comes entirely from the news articles, here are my thoughts.

Read More Read More

Can I use THINC API to cycle-start my Okuma P300?

Can I use THINC API to cycle-start my Okuma P300?

Perhaps the most common API programming question I’ve heard asked of Okuma representatives is: can THINC API be used to cycle-start my machine tool?

The answer is no.

But that answer makes for a short blog post, so let me elaborate.

Read More Read More

A Quick Intro to Okuma THINC

A Quick Intro to Okuma THINC

What is a THINC app?

In the broadest sense, a THINC app is an application made to run on Okuma OSP-P controls. This is Okuma’s line of Windows-based CNCs.

Even though normal Windows apps will run on the OSP controls, THINC apps are generally built to use the THINC API.

Ok… So what is THINC API?

An API — or application programming interface — that allows applications to interact with the CNC. For example, the THINC API provides methods for an application to read and write common variables, load part programs, read and write tool offsets, etc.

Read More Read More

P/Invoking Native Libraries

P/Invoking Native Libraries

You’re a VB.NET developer. You’re writing code, and you need to integrate with a machine tool, automation system, sensor, scanner, or some other bit of hardware.

Lucky for you, the manufacturer provides a library. But wait… it’s not a .NET library. You can’t just “Add Reference…” the DLL.

If you’ve never used P/Invoke, this is where you start.

Read More Read More