Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Invoke Node 'Get Last Event' Draw Coordinates

Please see the attached .png graphic.

I am drawing a rectangle on an IMAQ Vision front panel control. I use an invoke node 'Get Last Event' , 'Draw' Event, 'Coordinates' to determine when the rectangle has been drawn. The way to do this is if the sum of the coordinates are not equal to 0, the loop knows that a rectangle has been drawn and exits. My issue is is that sometimes when I start my code, the loop just exits immediately leading me to believe that the 'coordinates' are somehow not being reinitialized to 0 (for what reason I don't know). Most of the time it behaves properly and loop waits for my rectangle draw. I wanted to know if there is any way to reinitialize these coordinates to 0 programmatically.

Sincerely,

Don
0 Kudos
Message 1 of 5
(3,786 Views)
Hey Don,

A few things you can try are, if you are not already using the Clear ROI Invoke Method before going into your loop, you can try that. Another Invoke Method you can try placing before your loop is the "Reinit To Dflt" Reinitialize to Default method. One last thing you can try. Before going into your loop, call the 'Get Last Event' Invoke Node and see what the values of the Coordinates are. When calling the Get Last Event Invoke Node, it will return information about the most recent event on the image display control, and it also removes the event from the event queue. So what might have been happening is that there indeed was an event in that queue when you ran your program.

I hope this helps.

Regards,
DJ
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,769 Views)
Method 1: (Clear ROI): I already tried that awhile back with no success

Method 2: (Reinit to Dflt): Clears the whole image as I suspected it would since the default on the control is the blank control

Method 3: (Get Last Event): See the attached. I put this in another while loop prior to the original while loop that tests for coordinates NE 0. This while loop is only exited after coordinates EQ 0. I am hoping this will cause the event queue to thus be emptied prior to going into the original loop. So far so good but I'll keep you statused.


Sincerely,


Don
0 Kudos
Message 3 of 5
(3,764 Views)
Hey Don,
I just wanted to make sure that having the event queue to be emptied before going into your main loop is still working for you. This should work, and should initialize the event queue, but let me know if you see any further issues with this invoke node. Thanks and have a great day.

Regards,
DJ
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(3,738 Views)
So far the 'empty the queue' strategy seems to be working. Have had no further problems since I did this....thanks, Don
0 Kudos
Message 5 of 5
(3,735 Views)