Showing results for 
Search instead for 
Did you mean: 

How can I use Caliper measurement in my VI


I am currently working on machine vision project. I started with Vision Builder AI and then I migrated to LabVIEW in order to connect my measurement algorithm with DAQ signal acquisition. I need information about measured distance by Caliper function. I get it on the image, because I used Overlay function, but I don't how to spin this measurement off from caliper function i.e. to show measured value on Front Panel just as an Numeric Indicator. Any help is appreciated 🙂 I can post here any VI but I don't know which would be useful.




0 Kudos
Message 1 of 9

Dear Michael


As far as I see it, there are 3 approaches, depending on your SW architecture:


1. You have developed a VBAI inspection that performs most of your application requirements, but need LabVIEW to expand the flexibility (synch. with motion, DAQ, etc.). In this case, you can use the functions in Vision and Motion -> Vision Builder AI in order to programatically execute VBAI inspection and retrieve the step results with the help of: Get Inspection Measurements function.


2. You want to develop the Vision inspection from scratch and you own Vision Development Module. In this case, using the functions available you can acquire image, perform processing (also IMAQ Caliper Tool) and use the results.(unbundle the resulting cluster)


3.Hybrid mode -> You have developed an inspection in VBAI, exported it in LV code, in which case you have to dig in the application, find the caliper function and use the results further in your application.


Please let me know how it worked out for you,



0 Kudos
Message 2 of 9

Some other options include:

1- using the DAQmx step built into VBAI. This only allows for SW timed reading/writing digital/analog input/output channels. If you need to do anything with HW timed waveforms, or counters, or anything more advanced (i.e. triggering with DAQ) this option is not for you.

2 - You could use a Run LabVIEW step to call a VI that does daq/motion (i.e. anything you can do in LV).


I would generally not recommend migrating your inspection to LV if you need to integrate visual inspection with LV code because you cannot easily make changes to the vision algorithm once you convert your VBAI inspection to LV. A better solution if you do need integration with a larger LV application and your LV needs are more complicated than could fit in a DAQ step or Run LV step in VBAI is to use the VBAI VIs provided in the LV palette (As mentioned in the previous post).


If you still want to migrate your inspection to LV, here's a screenshot of how to access the results from the generated LV code


Hope this helps,



0 Kudos
Message 3 of 9

Thanks a lot for replies, they helped me understand few things connected with VBAI and LabVIEW. Well, unfortunately my VI is complex and in order to solve the problem I used different advanced programming techniques, which as I suppose are not provided in VBAI. Thank you for your advices, I solved the problem before. My solution is the same as advice from Brad. I found it hard to get this measurement because I was looking for it when my VI was not running and all what I could see was default values.


Now I have another problem, as mentioned Brad, it's harder  to change parameters in LabVIEW than in VBAI. I want to change template of pattern matching depending on user's choice. I tried to change parameters of Pattern Matching function in LabVIEW but without effects. If someone solved this problem before please let me know. Any advices are also appreciated.




0 Kudos
Message 4 of 9

Did you try the LV API for controlling Vision Builder AI? You can find some simple examples under your VBAI installed folder in the API Examples directory. I would strongly recommend going this route instead of trying to modify the generated LV code if you want to have the option to make changes to your VBAI inspection and easily use those changes in LV. Some big advantages of this route include:

- can control local VBAI Engines or VBAI engines running on RT Targets (like Smart Camera, CVS, or EVS)

- can have multiple VBAI inspections running in parallel and controlled from LV

- can easily make modification to your inspection in VBAI and save the inspection and then the LV code that uses that inspection will get the updates (i.e. no need to migrate inspection to LV and try and find your measurements of interest and connect them to your top level VI, etc.)

- can connect to VBAI engines of different versions (this makes it easy to control a VBAI engine and not have to worry about what version of VBAI it is using).

- You can use LV 8.5 and later (code generation only supports LV 2010 and later).

- you can easily control when the inspection starts each iteration (I guess you have this abuility with generated code as well, but you would have to modify the generated code to get this).


Bottom line, I think it's definitely worth looking into this option before trying to modify the generated code since you won't have an easy way to make changes to your vision algorithm.

Let me know if you have any questions on the API 🙂




P.S. If you want to change the pattern matching template on the fly. No good way to do this currently (either with the API or with the generated code). In the generated code case, you could update the template file on disk (located in the Configuration Files folder in your generated folder), but you would still need to stop the Main VI and then start it again for it to use the updated pattern matching template from disk. You could try and update it in memory while the inspection is running, but this is complicated. 

0 Kudos
Message 5 of 9

Thank you for your reply. Honestly I must say that I haven't heard about this option. I don't understand it right now, but I think that it could solve my problems. Tell me if I'm wrong, because I don't know how exactly use it in my VI. You mean that I could control VBAI algorithm from LabVIEW as a VI without migrating? Could you tell me what should I do in few steps how to do it?

I still look for examples you mentioned but I couldn't find them. Are they available from Examples finder in LabVIEW?

I would be very grateful if You could tell me how to improve my code by using this API?

I use LabVIEW 2009 and Vision Acquisition Software 2011.


Best regards,


0 Kudos
Message 6 of 9

Dear Michael,


If your installation of VBAI took place on a system with LabVIEW installed, you should see an API for interfacing with VBAI engine in Functions Palette->Vision and Motion->Vision Builder AI.


Here is an example code image




Try to build it by yourself and analyze the results. You can further develop variations from it to implement desired functionality.




0 Kudos
Message 7 of 9

Thank you for reply. It looks really great, but unfortunately I don't have that palette in my LabVIEW. I suppose that my license doesn't include it. That's why I had to fight with Migration to LabVIEW. I found link to trial Vision Builder AI 2010 but it doesn't work on page which you recommended e2m0i0l7. I've installed the newest Vision Acquisition Software and Vision Development Module, what else should I install?

0 Kudos
Message 8 of 9

Dear Michael,


Installing VBAI latest version should add the library to LV. It is true, seems that there is a short unavailability of VBAI on, I am sure it will be fixed really soon.


Please check back, and let me know how it worked out for you after installing VBAI.


Looking forward to your reply, 



0 Kudos
Message 9 of 9