CogPMAlignTool Run Method Cognex VisionPro 9.5
Runs the tool using the current parameter settings.

Namespace: Cognex.VisionPro.PMAlign
Assembly: Cognex.VisionPro.PMAlign (in Cognex.VisionPro.PMAlign.dll) Version: 69.0.0.0
Syntax

public override void Run()

Implements

ICogTool Run 
Events

Event TypeReason
ICogTool Running

Fires before the tool runs.

ICogChangedEvent Changed

Fires when the tool runs. If the run was successful, results are generated; if the run was not successful, no results are generated and the previous results are cleared. Use RunStatus after CogPMAlignTool returns or in a Ran event handler to determine whether a run was successful or unsuccessful.

The following state flags may be affected:

ICogTool Ran

Fires after the tool runs.

Exceptions

ExceptionCondition
CogSecurityViolationException

Security is not enabled for this vision tool. See Resolving Security-Related Error Messages for more information.

CogOperatorNoInputImageException

InputImage is NULL.

CogImageNoPixelsException

InputImage is not allocated.

CogOperatorNotTrainedException

Pattern is not trained.

CogOperatorInvalidRegionException

The selected space of the SearchRegion is not a valid space of the Image.

CogOperatorInvalidRegionException

SearchRegion falls completely outside of Image. (Clipping of SearchRegion by InputImage is permitted.)

ArgumentException

RunParams is NULL.

CogPMAlignPatMaxNotTrainedException

Pattern was not trained for PatMax and RunParams.RunAlgorithm is PatMax.

CogPMAlignPatQuickNotTrainedException

Pattern was not trained for PatQuick and RunParamsRunAlgorithm is PatQuick.

CogPMAlignPatFlexNotTrainedException

Pattern was not trained for PatFlex and RunParamsRunAlgorithm is PatFlex.

CogTimeoutExpiredException

The pattern location took longer than the value you specified for Timeout.

CogToolNoOperatorException

Pattern is NULL.

CogPMAlignSaveMatchInfoErrorException

SaveMatchInfo is not properly enabled (or disabled) when the ResultsMatchFeatures bit of LastRunRecordDiagEnable is set (or cleared).

CogPMAlignSaveDeformationInfoErrorException

SaveDeformationInfo is not properly enabled (or disabled) when the FlexDeformationGrid bit of LastRunRecordDiagEnable is set (or cleared).

Remarks

Runs the tool.

When RunMode is SearchImage (the default mode), calling this method attempts to locate this CogPMAlignTool's Pattern in this CogPMAlignTool's InputImage using this CogPMAlignTool's RunParams.

When RunMode is RefineStartPose, calling this method refines the StartPose instead of searching the image.

Check the RunStatus to determine whether this function succeeded, failed, or timed out. If the tool ran successfully, the results are available through the Results property.

Note: This method does not actually raise the exceptions listed below. Use the RunStatus property to obtain a ICogRunStatus reference. Then use its Exception property to see if the Run method raised any exceptions.

See Also

CogPMAlignPatternExecute(CogImage8Grey, ICogRegion, CogPMAlignRunParams)