private IAgCrdnCondition CreateCondition(IAgStkObject stkObject, string name, IAgCrdnCalcScalar scalar, AgECrdnConditionThresholdOption operation, double value) { IAgCrdnConditionFactory factory = stkObject.Vgt.Conditions.Factory; // Check if component exists. CheckExistingVgtComponent(stkObject.Vgt.Conditions, name); IAgCrdnConditionScalarBounds condition = factory.CreateConditionScalarBounds(name, "") as IAgCrdnConditionScalarBounds; condition.Scalar = scalar; condition.Operation = operation; // Min/Max must be IAgQuantity IAgQuantity valueQuantity = CommonData.StkRoot.ConversionUtility.NewQuantity("Angle", "deg", value); if (operation == AgECrdnConditionThresholdOption.eCrdnConditionThresholdOptionAboveMin) { condition.SetMinimum(valueQuantity); } else if (operation == AgECrdnConditionThresholdOption.eCrdnConditionThresholdOptionBelowMax) { condition.SetMaximum(valueQuantity); } return(condition as IAgCrdnCondition); }
public static void SetAngleConditionScalarBounds(IAgCrdnConditionScalarBounds condition, double angleLB, double angleUB) { IAgQuantity quant = CommonData.StkRoot.ConversionUtility.NewQuantity("Angle", "deg", angleLB); condition.SetMinimum(quant); quant = CommonData.StkRoot.ConversionUtility.NewQuantity("Angle", "deg", angleUB); condition.SetMaximum(quant); }