User`s guide

but will not delete the vision window. You can close and detach from the vision window, but
you cannot delete it.
To preserve the vision system pull-down menus, open the window in write-only mode:
FOPEN (glun) "Vision /WRITEONLY"
The following example opens the vision window, writes to the vision window, and detaches
the vision window:
.PROGRAM label.blob()
; ABSTRACT: This program demonstrates how to attach to the
; vision window and how to use the millimeter scaling mode of
; the GTRANS instruction to label a "blob" in the vision
; window.
;
AUTO vlun
cam = 1
; Attach the vision window and get a logical unit number
ATTACH (vlun, 4) "GRAPHICS"
IF IOSTAT(vlun) < 0 GOTO 100
FOPEN (vlun) "Vision" ;Open the vision window
IF IOSTAT(vlun) < 0 GOTO 100
; Select display mode and graphics mode
VDISPLAY (cam) 1, 1 ;Display grayscale frame and graphics
; Take a picture and locate an object
VPICTURE (cam) ;Take a processed picture
VLOCATE (cam, 2) "?" ;Attempt to locate an object
IF VFEATURE(1) THEN ;If an object was found...
GCOLOR (vlun) 1 ;Select the color black
GTRANS (vlun, 2) ;Select millimeter scaling
GTYPE (vlun) DX(vis.loc), DY(vis.loc), "Blob", 3
ELSE ;Else if object was NOT found...
GCOLOR (vlun) 3 ;Select the color red
GTRANS (vlun, 0) ;Select pixel scaling
GTYPE (vlun) 100, 100, "No object found!", 3
END
; Detach (frees up the communications path)
DETACH (vlun)
100 IF (IOSTAT(vlun) < 0) THEN ; Check for errors
TYPE $ERROR(IOSTAT(vlun))
END
.END
Communicating With the System Windows
V+Language User's Guide, v17.0
Page 260