Question
While developing your VisionPro/Cognex Designer application, you might need to programmatically change the device Scan Length from script based on the application need.
Answer
It has to be done using the acqFifo.OwnedROIParams.SetROIXYWidthHeight() method replacing the new Height.
Please note it is recommended to add the script at the application startup or after the Task Inspection/in a step of the application when the device is not busy acquiring, otherwise it won't be accessible to be read/written.
Below a sample code for Cognex Designer - please note: Cognex.VisionPro has to be added as a Using to the script
For Cognex Designer scripting details (like where-to-find the Using box) see also: Cognex Designer - Script Editor - Documentation | Cognex
ICogAcqFifo acqFifo = (ICogAcqFifo)$System.GetInternalObject("Devices.DeviceName") //The DeviceName has to be replaced, for example with DS1101R int x, y, width, currentHeight, newHeight = 0; //retrieving the existing current values return newHeight; |