Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

can Vision builder AI communicate with C#

Q1) i doing a project which i need do some calculation by the calculator function  in Vision Builder AI. After that i need to send the result( in  numerical) of the calculation to C# and receive data from C# .

is there anyway for vision  builder to do this kind of 2 way communication?

 

Q2) for vision builder ai 2009, it is possible for the data that generate at "state 1" to be use at "state 2"?

 

thanks.

Message 1 of 10
(6,197 Views)

Q1) There are multiple ways for Vision Builder to communicate with 3rd party software:

1) Vision Builder AI ships with an ActiveX control that you can call from C#. The ActiveX allows to drive the Vision Builder Engine from your application.

You can open an inspection, run it once, retrieve the results of each step, run continuously, etc..

2) If you just need to exchange data between Vision Builder and your application, Vision Builder supports a number of protocols you can use, like TCP/IP and Modbus. Use to TCP/IP step to send or receive data from your application.

Vision Builder is also a Modbus Server. If you have a Modbus library that you can use in C#, I would recommend this method. Use the Modbus Slave step in Vision Builder to set some registers and your Modbus library in C# can read them and vice versa. This method should be easier to implement that TCP/IP.

 

Q2) The way to share data between states in Vision Builder AI is to use variables. Go to Tools>>Variable Manager and create a variable. Use the Set Variable step to set the value of a variable in one state. The variable is accessible in subsequent states, as parameters of steps that support previous measurements (steps that have numeric like controls, with a pulldown that lets you select a a previous  measurement).

 

Hope this answers your questions. Feel free to post if you need more clarifications.

 

Best regards,

 

Christophe

Message 2 of 10
(6,187 Views)

thank you ChristopheC

But i need your help on the 

"

If you just need to exchange data between Vision Builder and your application, Vision Builder supports a number of protocols you can use, like TCP/IP and Modbus. Use to TCP/IP step to send or receive data from your application.

Vision Builder is also a Modbus Server. If you have a Modbus library that you can use in C#, I would recommend this method. Use the Modbus Slave step in Vision Builder to set some registers and your Modbus library in C# can read them and vice versa. This method should be easier to implement that TCP/IP.

"

 

Can u give me some detail explanation or example on this solution.

and where can i get the references for all this solution,czs i need it in my report.

thanks. ^^

0 Kudos
Message 3 of 10
(6,134 Views)

On the Vision Builder AI side, you would need to configure Vision Builder as a Modbus Slave. By doing that, you basically create a set of registers that can be accessed either for read or write, by queries from your C# program. To do that, go to Tools>>Communication Device Manager. Create a new device that corresponds to your C# application. Select Modbus TCP for the protocol and click OK. Click Start Server to start the Modbus Server and start accepting incoming Modbus TCP requests. In your inspection, use the Modbus Slave step, located in the Communicate palette, to either read or write Modbus registers. You can read registers that are updated by your C# application, or write registers for your C# application to read. I am attaching an example that writes the inspection status (pass/fail) to the first register of the Discrete Input table, and the average intensity to the first register of the Input Register Table.

 

You're going to need a .NET modbus library (Master) to be able to implement the communication on the C# side. I couldn't find any free library for download on the web, but several companies offer commercial libraries for .NET, such as http://www.modbusdriver.com/dotnet

I haven't used any of them in C#, so I cannot recommend one other another. Just google .NET Modbus library and read reviews.

Typically, those libraries will allow you to open a connection to the Vision Builder AI slave, and read and write the registers over TCP.

You can think of these Modbus Registers as shared memory, living in Vision Builder AI (slave) that can be accessed by both Vision Builder and your C# application.

 

I hope this helps. Feel free to post more if you have further questions.

 

Best regards,

 

Christophe

0 Kudos
Message 4 of 10
(6,124 Views)

thanks ChristopheC.

is there possible for me if i do a calculation at Vision Builder AI and after that C# will access to Vision Builder AI just to read the result of the calculation? 

Message 5 of 10
(6,015 Views)

Hi. I might be responding to an old post, but I'd really like to be able to do this:

1) Vision Builder AI ships with an ActiveX control that you can call from C#. The ActiveX allows to drive the Vision Builder Engine from your application.

You can open an inspection, run it once, retrieve the results of each step, run continuously, etc..

 

I can't locate any ActiveX drivers for Vision Builder. (I found labview files for this, but that doesn't help with Vision Builder).

 

Can anyone please help?

 

Thank you and Best regards

 

Richard

0 Kudos
Message 6 of 10
(5,509 Views)

If you are using Vision Builder AI 2011, it comes with C support and provides a dotNET example and has lots of advantages over the old ActiveX method. The ActiveX method will no longer be supported for future versions, so I recommend you try out the new C API which includes a dotNET example in VBAI 2011. If you have VBAI 2011 installed, you will find C and dotNET examples under the Vision Builder AI 2011/API examples folder.

 

Hope this helps,

Brad

0 Kudos
Message 7 of 10
(5,507 Views)

Hi,

 

We are seriously looking at using vbai again. We have used it in the past

in the VB6/ActiveX days.

 

Does the new .net interface support C# API calls. I keep seeing C referenced

in your remarks and not C#.

 

I was told we can used shared variables to access properties of inspections.

 

Is that true or we confined to MODBUS calls?.  The old system had API

calls that could access the result properties directly.

 

thanks,

 

0 Kudos
Message 8 of 10
(5,417 Views)

VBAI 2011 has a shipping c# example. The assembly is just part of the example, but you can easily use it in your C# app to have a better programming experience than calling the C dll directly. The assembly allow for getting results, images, loading inspections, ect. Everything you can do with the C and LV API you can do wwith the dotNET assembly provided in the example. You can always download an evaluation version and try it out to see how it works and what it's like.

https://lumen.ni.com/nicif/us/machinevisionbrochure/content.xhtml

 

Hope this helps,

Brad 

0 Kudos
Message 9 of 10
(5,415 Views)

Brad,

 

thanks for the quick reply...

 

You answered my next question, Does the eval allow us to do the whole

deal using C# calls etc and it sounds like it does. This is a great.

 

I worked with you guys developing the original Active X stuff back on

Version 1.0 so nice to know you followed through with it to C#. net.

 

We will download and test. We were thinking of trying a DirectShow USB

camera which according to Microsoft is anything USB is DirectShow from

what we read.

 

Looks like VBAI has matured nicely.

 

thanks for your help...

0 Kudos
Message 10 of 10
(5,410 Views)