Display Element
The Display element is available in any Visualization page. It is the standard way to show inspection results — images with vision element overlays — directly in the OneVision interface.
Accessible in scripts as:
Visu.page0.display1
Methods
sendCapture()
Sends a Capture to the display. Returns a paintId string that identifies this capture in the history.
sendCapture(capture: Capture): string;
This is the most common way to show an inspection result. A Capture bundles an image together with any number of named vision element groups.
var capture = new Capture(image, "inspection");
capture.addVisionElement(result.detections, "Detections");
var paintId = Visu.page0.display1.sendCapture(capture);
sendCaptures()
Sends multiple captures at once. Optionally specify which capture index to display first.
sendCaptures(captures: Capture[]): void;
sendCaptures(captures: Capture[], captureIndex: number): void;
Useful when a single inspection produces multiple images (e.g. multi-camera setups).
sendUnit()
Sends a Unit to the display. The display will show the captures contained in the unit.
Show the default capture:
sendUnit(unit: Unit): void;
Show a specific capture by index:
sendUnit(unit: Unit, captureIndex: number): void;
Show a specific capture by name:
sendUnit(unit: Unit, captureName: string): void;
// Show the capture named "top-camera" from the unit
Visu.page0.display1.sendUnit(unit, "top-camera");
clear()
Clears the display and removes all capture history.
clear(): void;
setEnableFullScreen()
Enables or disables the full-screen mode. When disabled, the user cannot open the display in full-screen.
setEnableFullScreen(enable: boolean): void;
getEnableFullScreen()
Returns whether full-screen mode is currently enabled.
getEnableFullScreen(): boolean;
setEnableHoveringEntities()
Enables or disables highlighting of vision elements when the user hovers over them in the full-screen view.
setEnableHoveringEntities(enable: boolean): void;
getEnableHoveringEntities()
Returns whether entity hovering is currently enabled.
getEnableHoveringEntities(): boolean;
saveImage()
Saves the current display view (image + overlays) to a file on disk.
saveImage(imagePath: string): void;
Visu.page0.display1.saveImage("C:/output/result.png");
The file format is determined by the extension. Common formats: .png, .jpg, .bmp.
getController()
Returns the Display Controller for advanced control over the image, individual elements, zoom, and user interaction tools.
getController(): DisplayControllerWrapper;
Call getController() once in an INIT script and store the result in a global variable. Calling it repeatedly in a cyclic script is unnecessary.
// INIT script
global var ctrl = Visu.page0.display1.getController();
Properties
hasUserInput
true when the user has clicked on the mini-display since the last time it was read. Reset to false to acknowledge the input.
hasUserInput: boolean;
pointerPositionX
The X coordinate of the last pointer position in image pixels.
pointerPositionX: number;
pointerPositionY
The Y coordinate of the last pointer position in image pixels.
pointerPositionY: number;
lastPaintId
lastPaintId is no longer used in newer versions and will be removed in a future release.
The paintId of the capture currently shown in the display. Matches the value returned by the last sendCapture() call that was rendered.
lastPaintId: string;
isFullScreen
true when the display is currently open in full-screen mode.
isFullScreen: boolean;
numHistoryElements
The maximum number of captures kept in the history. Get or set this value to control how many past captures the user can browse.
numHistoryElements: number;