02-02-2012 04:50 AM
Hi
I'm like to use CVI to control and receive informations from the Vision Builder AI 2011. There is a CVI API Example in the VBAI folder which I use. This functions should return information about each step of the currently loaded inspection
and the second function the measurement data for all steps and variables.
VBAIInspectionSteps* steps = NULL;
VBAIMeasurements* measurements = NULL;
// Dynamically allocates the memory needed for steps.
error = vbaiGetInspectionSteps (session, &steps);
if (error)
break;
error = vbaiGetInspectionMeasurements (session, NULL, 0, &measurements, &iterationTimestamp);
if(error)
break;
But when I use the variables window in CVI, the variable "steps" returs just the first step and "measurements" only the first measurement of the first step. The function call "vbaiGetVariables" as opposed to this returns the informations of each variables.
I'm using the default CVI API example, do I have to add any special librarys or header? What's wrong can you help me?
Thanks Stefan
02-02-2012 08:19 AM
This is a problem with the CVI debug watch window. I was able to right click on the "steps" variable and "Edit Watch Expression" and type in steps->steps[3] and then I saw the results for the 4th step. I think the reason CVI doesn't show the results for the individual steps is because the array is allocated dynamically inside the function so CVI doesn't know how big the array is. For other data types, you allocate the memory yourself so CVI knows how big the array is.
The reason some of the functions allocate the memory themselves is because the data type includes strings or other variable length data and instead of having overly large fixed data sizes that would reserve more memory than needed statically, the function dynamically allocates only what it needs to help improve memory usage.
Hope this helps,
Brad
02-02-2012 09:51 AM
Thank you this is what I wanted to know.