Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Update tolerances in VBAI in real time via ActiveX?

I was wondering if anybody out there has been able to successfully use VBAI 2.6.1 or 3.0 in such a way that they can On The Fly update tolerances of features...ie) binary level of a count pixels step, or upper/lower tolerances of a count pixel step.  I currently run VBAI on several CVS 1456s.  I wish to accomplish this via VBAI, perhaps by adding a LV7(or LV 8 if I have to use VBAI 3.0) step into it, or what have you, however, I do not want to run LV on the CVS.  I want to continue using VBAI for ease of programming for others.  A while back Steffen Hoog suggested ActiveX components (see below).  I know nothing about ActiveX stuff and just wondered if anyone out there knew of any good resources available here in the message board or ni's site that could help guide me towards this light.  As always, I appreciate any suggestions that you may have and I thank you for your time. 
 

Steffen Hoog recommended the following:

1.) VBAI 2.6 has an ActiveX interface. You could install a development enviroment like LabVIEW, CVI, VB, etc on your host PC and call the VBAI-Sequence running at the target via ActiveX to transfer step results or images to the host for example.
2.) ActiveX could be also an interface to change tolerances during runtime.
3.) you can use the serial IO step to set tolerances dynamicly. After that typecast the string into a numeric value, and compare this value with a constant (min, max) in a decision making step. Do not set the limits in the analyse step. Because you use the decision making step therefore.

http://forums.ni.com/ni/board/message?board.id=200&message.id=7265&query.id=191238#M7265

Message Edited by scott_7723 on 02-19-2007 11:12 AM

Message Edited by scott_7723 on 02-19-2007 11:13 AM

0 Kudos
Message 1 of 44
(5,629 Views)

scott_7723,


Steffen’s suggestion is probably the best route to follow in achieving that functionality.  Here are some helpful resources on ActiveX:


ActiveX and LabVIEW

Technology Brief - ActiveX/COM

ActiveX for Beginners

Those are three tutorials on our website.  You may notice that most of these are a bit old as ActiveX has been around for a while.  Here is a link to the faceted navigation to the ActiveX tutorials and examples on the NI Site.  ActiveX Results

Hopefully that helps.  Please let us know if you have any further questions or concerns.

Regards,
Luke H

Message 2 of 44
(5,597 Views)
Thanks Luke.  I have looked through those links and have found them somewhat useful.  Unfortunately, the last one you had : "ActiveX Results" is not a valid path.  No matter though.  I will have to figure out how to use ActiveX with VBAI.  Any specific info on that alone would be wonderful, however, it does not look like there is much out there.  Thanks again for your time.
0 Kudos
Message 3 of 44
(5,590 Views)
Vision Builder AI ships with a LabVIEW example that shows how to communicate between LabVIEW and Vision Builder using Active X.
If you're using Vision Builder AI 3.0, you need LabVIEW 8.2 to use the ActiveX component.
 
Christophe
 
Message 4 of 44
(5,579 Views)
At this rate I guess I am not surprised that I didn't look there before.  Thanks.  I just wish I could figure out how to pull the actual steps out of each inspection to adjust them.  I'll keep trying to explore each vi until I find something that works.  Clearly I haven't learned enough LabVIEW yet.  I suppose that just comes with trial and error. 
0 Kudos
Message 5 of 44
(5,572 Views)
It seems very simple to grab the main information like inspection description, date modified, etc.  Just having a tough time finding the actual inspection steps and there properties then being able to change them on the fly without disrupting VBAI.

Message Edited by scott_7723 on 02-23-2007 08:53 AM

0 Kudos
Message 6 of 44
(5,564 Views)

Scott,

I am going to write an example for you. Stephen's answer was a little misleading. It is not yet possible to use ActiveX methods/properties to dynamically set the tolerances. That is a good suggestion. We'll look into that. What Stephen said is that you can communicate between your application and Vision Builder AI (using for example serial, TCP or Modbus) to send the tolerances that you can then use in Vision Builder to make the Pass/Fail decisions. The best way to do it right now, is to use the Modbus protocol. Vision Builder AI can be configured to be a Modbus server. Vision Builder contains a set of registers that you can use to communicate with external devices / applications. Your application uses the Modbus protocol to write to these registers. In your case, you'll write the tolerances. To make the pass/fail decisions in the inspection, you're going to have to use for example the decision making step, to compare the result of a step to the Modbus registers where you stored the tolerances for that step. You actually don't need ActiveX to do that, but instead a set of Modbus VIs that you can download from our website. You can use the same principle to transfer data (for example results) from Vision Builder to your application. You use the Modbus step in Vision Builder AI to store results in some Modbus registers, and your application just queries these results, although it is probably better to use ActiveX to retrieve results, because you don't have to add any additional steps to your inspection to store the results in the Modbus registers.

To write you the example, please reply with the version of Vision Builder AI and the version of LabVIEW you are using. Once I have that, please give me a couple hours to write the example and update the post.

Thanks,

Christophe

NI Vision R&D

Message 7 of 44
(5,557 Views)
Wow, thank you so much for this CristopheC.  I currently use VBAI 2.6.1 on the CVS'.  I have VBAI 2.5-3.0 along with LV 7.1 & 8.0-8.2, however, at this time the VBAI 2.6.1 with LV 7.1 is the best option until I am able to update the software on the CVS.  Unfortunately I had issues with upgrading to VBAI 3.0 on the CVS's (more so than when I went from 2.5 to 2.6) this time I had issues with the product selection, inspections not converting to the 2.6 version properly and lagging issues, but that is another issue that never got resolved and I will have to resolve later.  Once again, thank you so much for your help.  Please let me know if there is anything else you need from me.
0 Kudos
Message 8 of 44
(5,554 Views)
correction: I had issues with the inspections not converting to the 3.0 version
0 Kudos
Message 9 of 44
(5,550 Views)

Scott,

Here is an example on how to dynamically set the limits of your inspection from LabVIEW 7.1. I am attaching the Vision Builder AI 2.6.1 inspection and the LabVIEW 7.1 example. Here's how to get it to work:

1) Unzip the inspection and import it in Vision Builder AI. (File>>Open, then select Tools>>Import Inspection).

The inspection is the Tutorial 1 that I slightly modified to read the limits from the modbus holding registers 0 and 1, use a decision making step to make sure the number of matches is in the range between register 0 and 1 that I've just read. And I added a final step to write to a couple other registers the number of matches found and the inspection status. If you've never used Modbus, Modbus is just a Master/Slave communication protocol that sits on top of the Ethernet or Serial physical layers. In this case, we're using Modbus TCP. The slave or server (Vision Builder) contains a set of registers (4 tables): holding registers (16 bit registers that the master can also write to), input registers (16 bit registers that are read only by the master), coils (binary registers writable by the master), and discrete inputs (binary register that are read only by the master). Vision Builder has access to all of them. The master (your LabVIEW application) can write to the holding registers of the coils and can only read the input registers and discrete inputs.

2) In configuration mode, you need to declare a Modbus device (this is going to be the LabVIEW program communicating with Vision Builder). To do that, select Tools>>Communication Device Manager. Click on New Device. Give it a name (for example LabVIEW Application). The device type is master (LabVIEW is going to initiate the communication with VBAI). Select Modbus TCP as the protocol. Click OK. Then Click Start Server to launch the background task that is going to listen to the Modbus frames.

3) Run the inspection.

4) Open LabVIEW 7.1 and the VI   NI Modbus.llb\MB Set VBAI Tolerances.vi.

The VI opens a connection with VBAI, then sends Modbus queries to either set the limits when you modify value of the controls on the front panel, and continuously read the # of matches and inspection status. This works on both Windows and the CVS. Make sure you declare the Modbus device when you're connected to the CVS, and specify the CVS' IP address in the VI.

I hope this will help you with your application.

Also, I'd like to know what went wrong with the import of the 2.6 inspection in 3.0. If you don't mind, please send me the inspection so we can try to reproduce and fix the problem.

Hope this helps,

Best regards,

Christophe

NI Vision R&D

Download All
Message 10 of 44
(5,540 Views)