CimLimit.Set (method)

Sets the low and high limits at the same time.
Syntax: object.Set Low, High
Parameters:
Low As double - Specifies the value the low limit is set to.
High As double - Specifies the value the high limit is set to.
Description: CimLimit.Set provides you with a way to set both low and high limits at the same time. This method is particularly useful if you are setting the low limit to a value that is greater or equal to the current high limit or the high limit to a value that is less or equal to the current low limit. By using this method, you do not have to check for these conditions to determine which limit to set first and prevent an automation exception.

Example

An axis has a low limit of 100 and a high limit of 200.

If you want to set the low limit to 300 and the high limit to 400 without using the Set method, you need to set the high limit first and then the low limit last so that the low limit is never higher that the high limit.

If you want to set the low limit to -50 and the high limit to 50 without using the Set method, you need to set the low limit first and then the high limit last so that the high limit is never lower that the low limit.

The following CimView script excerpt shows an example of how the code looks when you need to check for these conditions:
If NewLow >= cimOleObj.X(0).Limit.High Then
    cimOleObj.X(0).Limit.High = NewHigh
    cimOleObj.X(0).Limit.Low = NewLow
ElseIf NewHigh <= cimOleObj.X(0).Limit.Low Then
    cimOleObj.X(0).Limit.Low = NewLow
    cimOleObj.X(0).Limit.High = NewHigh
Else
    cimOleObj.X(0).Limit.Low = NewLow
    cimOleObj.X(0).Limit.High = NewHigh
End If

By using the Set method, you do not have to check for these conditions.

The following CimView script excerpt shows an example of how the code looks when using the Set method:
cimOleObj.X(0).Limit.Set NewLow, NewHigh