CogVerificationParamsExpectedOutputsContainer Add Method (String, Double, Double)Cognex VisionPro
Adds an expected output with the given key, an expectedValue and a range to the record.

Namespace: Cognex.VisionPro.Inspection
Assembly: Cognex.VisionPro.Inspection (in Cognex.VisionPro.Inspection.dll) Version: 65.1.0.0 (65.1.0.0)
Syntax

public void Add(
	string key,
	double expectedValue,
	double range
)

Parameters

key
Type: System String
The key to be added to the Record's ExpectedOutput parameters. The key has to be unique
expectedValue
Type: System Double
The value to be assigned with the given key
range
Type: System Double
The range to be assigned with the given expectedValue. The range is used by the verifier during verification to allow the expectedValue to vary by +/- the range
Exceptions

ExceptionCondition
ExceptionThrown if the key is not unique.
Examples

Imports Cognex.VisionPro
Imports Cognex.VisionPro.Database
Imports Cognex.VisionPro.Inspection

Private Sub AddProperty()
        Dim mInputDatabase As New CogVerificationDatabase(New CogDatabaseDirectory("C:\SampleDatabase"))
        mInputDatabase.Connect()

        Dim mCurrentRecord As CogVerificationData = mInputDatabase.Fetch(0)

        ' Add additional property to the record with the name "Area", a value of 3.1415 and a range of +-0.5
        mCurrentRecord.Params.ExpectedOutputs.Add("Area", 3.1415, 0.5)

        ' Change the additional property "Area"
        mCurrentRecord.Params.ExpectedOutputs.Record.SubRecords("Area").Content = 2.7182

        ' Change the range for the additional property "Area"
        ' WARNING: Works only if the additional property was created with a range
        mCurrentRecord.Params.ExpectedOutputs.Record.SubRecords("Area").SubRecords(CogFieldNameConstants.RkRange).Content = 0.2

        ' Update the record in the database
        mInputDatabase.Replace(mCurrentRecord)

        mInputDatabase.Disconnect()
End Sub
using Cognex.VisionPro;
using Cognex.VisionPro.Database;
using Cognex.VisionPro.Inspection;

private AddProperty()
{
    CogVerificationDatabase mInputDatabase = new CogVerificationDatabase(new CogDatabaseDirectory(@"C:\SampleDatabase"));
    mInputDatabase.Connect();

    CogVerificationData mCurrentRecord = mInputDatabase.Fetch(0);

    // Add additional property to the record with the name "Area", a value of 3.1415 and a range of +-0.5
    mCurrentRecord.Params.ExpectedOutputs.Add("Area", 3.1415 , 0.5);

    // Change the additional property "Area"
    mCurrentRecord.Params.ExpectedOutputs.Record.SubRecords["Area"].Content = 2.7182;

    // Change the range for the additional property "Area" 
    // WARNING: Works only if the additional property was created with a range
    mCurrentRecord.Params.ExpectedOutputs.Record.SubRecords["Area"].SubRecords[CogFieldNameConstants.RkRange].Content = 0.2;

    // Update the record in the database
    mInputDatabase.Replace(mCurrentRecord);

    mInputDatabase.Disconnect();
}
See Also