Example #1
0
        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);
        }
Example #2
0
        private IAgCrdnCondition CreateCondition(IAgStkObject stkObject, string name, IAgCrdnCalcScalar scalar, AgECrdnConditionThresholdOption operation, double minimum, double maximum)
        {
            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 minQuantity = CommonData.StkRoot.ConversionUtility.NewQuantity("Angle", "deg", minimum);
            IAgQuantity maxQuantity = CommonData.StkRoot.ConversionUtility.NewQuantity("Angle", "deg", maximum);

            condition.Set(minQuantity, maxQuantity);

            return(condition as IAgCrdnCondition);
        }