Esempio n. 1
0
 public void SetSpring(string name,
                       Stiffness stiffnesses,
                       bool isLocalCoordinateSystem = false,
                       bool replace       = false,
                       eItemType itemType = eItemType.Object)
 {
 }
Esempio n. 2
0
        /// <summary>
        /// Retrieves an existing named point spring property.
        /// </summary>
        /// <param name="name">The name of the point spring property.</param>
        /// <param name="stiffnessSource">The source of the spring stiffness derivation.</param>
        /// <param name="effectiveStiffness">The effective stiffness.</param>
        /// <param name="coordinateSystem">The name of the coordinate system in which the property is defined.</param>
        /// <param name="soilProfile">The name of an existing Soil Profile.</param>
        /// <param name="footing">The name of an existing Isolated Column Footing.</param>
        /// <param name="period">The first-mode time period. [sec].</param>
        /// <param name="color">The display color for the property specified as an integer.</param>
        /// <param name="notes">The notes, if any, assigned to the property.</param>
        /// <param name="GUID">The GUID (global unique identifier), if any, assigned to the property.</param>
        public void GetPointSpringProperties(string name,
                                             ref eSpringStiffnessDerivation stiffnessSource,
                                             ref Stiffness effectiveStiffness,
                                             ref string coordinateSystem,
                                             ref string soilProfile,
                                             ref string footing,
                                             ref double period,
                                             ref int color,
                                             ref string notes,
                                             ref string GUID)
        {
            double[] k = new double[0];
            int      csiStiffnessSource = 0;

            _callCode = _sapModel.PropPointSpring.GetPointSpringProp(name,
                                                                     ref csiStiffnessSource,
                                                                     ref k,
                                                                     ref coordinateSystem,
                                                                     ref soilProfile, ref footing, ref period,
                                                                     ref color, ref notes, ref GUID);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException();
            }

            stiffnessSource = (eSpringStiffnessDerivation)csiStiffnessSource;
            effectiveStiffness.FromArray(k);
        }
Esempio n. 3
0
 public void Merge(INodeDataComponent other)
 {
     if (other is NodeSupport)
     {
         NodeSupport otherS = (NodeSupport)other;
         Fixity    = Fixity.Or(otherS.Fixity);
         Stiffness = Stiffness.MergeMax(otherS.Stiffness);
         //TODO: Axis merging
     }
 }
Esempio n. 4
0
 public void SetPointSpringProperties(string name,
                                      eSpringStiffnessDerivation stiffnessSource,
                                      Stiffness effectiveStiffness,
                                      string coordinateSystem = CoordinateSystems.Global,
                                      string soilProfile      = "",
                                      string footing          = "",
                                      double period           = 0,
                                      int color    = 0,
                                      string notes = "",
                                      string GUID  = "")
 {
 }
Esempio n. 5
0
 public void GetPointSpringProperties(string name,
                                      ref eSpringStiffnessDerivation stiffnessSource,
                                      ref Stiffness effectiveStiffness,
                                      ref string coordinateSystem,
                                      ref string soilProfile,
                                      ref string footing,
                                      ref double period,
                                      ref int color,
                                      ref string notes,
                                      ref string GUID)
 {
 }
Esempio n. 6
0
        /// <summary>
        /// This function retrieves uncoupled spring stiffness assignments for a point element;
        /// that is, it retrieves the diagonal terms in the 6x6 spring matrix for the point element.
        /// The spring stiffnesses reported are the sum of all springs assigned to the point element either directly or indirectly through line, area and solid spring assignments.
        /// The spring stiffness values are reported in the point local coordinate system.
        /// </summary>
        /// <param name="name">The name of an existing point element.</param>
        /// <param name="stiffnesses">Spring stiffness values for each decoupled degree of freedom.</param>
        /// <exception cref="CSiException"></exception>
        public void GetSpring(string name,
                              ref Stiffness stiffnesses)
        {
            double[] csiStiffnesses = new double[0];

            _callCode = _sapModel.PointElm.GetSpring(name, ref csiStiffnesses);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException();
            }

            stiffnesses.FromArray(csiStiffnesses);
        }
Esempio n. 7
0
        /// <summary>
        /// Returns uncoupled spring stiffness assignments for a point element;
        /// that is, it retrieves the diagonal terms in the 6x6 spring matrix for the point element.
        /// The spring stiffnesses reported are the sum of all springs assigned to the point element either directly or indirectly through line, area and solid spring assignments.
        /// The spring stiffness values are reported in the point local coordinate system.
        /// </summary>
        /// <param name="name">The name of an existing point element.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public Stiffness GetSpring(string name)
        {
            double[] csiStiffnesses = new double[0];

            _callCode = _sapModel.PointElm.GetSpring(name, ref csiStiffnesses);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }

            Stiffness stiffnesses = new Stiffness();

            stiffnesses.FromArray(csiStiffnesses);
            return(stiffnesses);
        }
Esempio n. 8
0
        /// <summary>
        /// Creates a new named point spring property, or modifies an existing named point spring property.
        /// </summary>
        /// <param name="name">The name of the point spring property.</param>
        /// <param name="stiffnessSource">The source of the spring stiffness derivation.</param>
        /// <param name="effectiveStiffness">The effective stiffness.</param>
        /// <param name="coordinateSystem">The name of the coordinate system in which the property is defined.</param>
        /// <param name="soilProfile">The name of an existing Soil Profile.</param>
        /// <param name="footing">The name of an existing Isolated Column Footing.</param>
        /// <param name="period">The first-mode time period. [sec].</param>
        /// <param name="color">The display color for the property specified as an integer.</param>
        /// <param name="notes">The notes, if any, assigned to the property.</param>
        /// <param name="GUID">The GUID (global unique identifier), if any, assigned to the property.</param>
        public void SetPointSpringProperties(string name,
                                             eSpringStiffnessDerivation stiffnessSource,
                                             Stiffness effectiveStiffness,
                                             string coordinateSystem = CoordinateSystems.Global,
                                             string soilProfile      = "",
                                             string footing          = "",
                                             double period           = 0,
                                             int color    = 0,
                                             string notes = "",
                                             string GUID  = "")
        {
            double[] k = effectiveStiffness.ToArray();

            _callCode = _sapModel.PropPointSpring.SetPointSpringProp(name,
                                                                     (int)stiffnessSource,
                                                                     ref k,
                                                                     coordinateSystem,
                                                                     soilProfile, footing, period,
                                                                     color, notes, GUID);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException();
            }
        }
        /// <inheritdoc />
        public object ConvertBack(object value,
                                  Type targetType,
                                  object parameter,
                                  CultureInfo culture)
        {
            if (!this.initialized)
            {
                Initialize();
            }

            var message = this.errorText.ToString();

            if (!(targetType == typeof(Stiffness) || targetType == typeof(Stiffness?)))
            {
                message += $"{GetType().Name} does not support converting to {targetType.Name}";
            }

            if (message != string.Empty)
            {
                message = message.TrimEnd('\r', '\n');
                if (Is.DesignMode)
                {
                    throw new InvalidOperationException(message);
                }

                return(message);
            }

            if (value == null)
            {
                return(null);
            }


            if (value is double)
            {
                return(new Stiffness((double)value, this.unit.Value));
            }

            var text = value as string;

            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            var unitInput = UnitInput ?? Wpf.UnitInput.ScalarOnly;

            switch (unitInput)
            {
            case Wpf.UnitInput.ScalarOnly:
            {
                double d;
                if (double.TryParse(text, NumberStyles.Float, culture, out d))
                {
                    return(new Stiffness(d, this.unit.Value));
                }
                Stiffness result;
                if (Stiffness.TryParse(text, NumberStyles.Float, culture, out result))
                {
                    return($"#{text}#");        // returning modified text so that TypeConverter fails and we get an error
                }

                return(text);        // returning raw to trigger error
            }

            case Wpf.UnitInput.SymbolAllowed:
            {
                double d;
                int    pos = 0;
                WhiteSpaceReader.TryRead(text, ref pos);
                if (DoubleReader.TryRead(text, ref pos, NumberStyles.Float, culture, out d))
                {
                    WhiteSpaceReader.TryRead(text, ref pos);
                    if (pos == text.Length)
                    {
                        return(new Stiffness(d, this.unit.Value));
                    }
                }

                goto case Wpf.UnitInput.SymbolRequired;
            }

            case Wpf.UnitInput.SymbolRequired:
            {
                Stiffness result;
                if (Stiffness.TryParse(text, NumberStyles.Float, culture, out result))
                {
                    return(result);
                }

                return(text);
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 10
0
 public void GetSpring(string name,
                       ref Stiffness stiffnesses)
 {
 }
Esempio n. 11
0
 public StiffnessExtension(Stiffness value)
 {
     this.Value = value;
 }
Esempio n. 12
0
        public override object ReadJson(JsonReader reader, Type objectType, object?existingValue, JsonSerializer serializer)
        {
            var stringValue = (string)reader.Value !;

            return(Stiffness.Parse(stringValue, serializer.Culture));
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "center")
            {
                Center = parser.ParseSFVec3fValue();
            }
            else if (id == "children")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DChildNode child = node as IX3DHAnimJointChildren;
                    if (child == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Children.Add(child);
                    }
                }
            }
            else if (id == "displacers")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    IX3DHAnimDisplacerNode displacer = node as IX3DHAnimDisplacerNode;
                    if (displacer == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Displacers.Add(displacer);
                    }
                }
            }
            else if (id == "limitOrientation")
            {
                LimitOrientation = parser.ParseSFRotationValue();
            }
            else if (id == "llimit")
            {
                Llimit.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "name")
            {
                Name = parser.ParseStringValue();
            }
            else if (id == "rotation")
            {
                Rotation = parser.ParseSFRotationValue();
            }
            else if (id == "scale")
            {
                Scale = parser.ParseSFVec3fValue();
            }
            else if (id == "scaleOrientation")
            {
                ScaleOrientation = parser.ParseSFRotationValue();
            }
            else if (id == "skinCoordIndex")
            {
                SkinCoordIndex.AddRange(parser.ParseSFInt32OrMFInt32Value());
            }
            else if (id == "skinCoordWeight")
            {
                SkinCoordWeight.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "stiffness")
            {
                if (wasStiffness)
                {
                    Stiffness.AddRange(parser.ParseSFFloatOrMFFloatValue());
                }
                else
                {
                    Stiffness = parser.ParseSFFloatOrMFFloatValue();
                }
                wasStiffness = true;
            }
            else if (id == "translation")
            {
                Translation = parser.ParseSFVec3fValue();
            }
            else if (id == "ulimit")
            {
                Ulimit.AddRange(parser.ParseSFFloatOrMFFloatValue());
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
 protected void SetScalarValue(DependencyProperty property, Stiffness? quantity)
 {
     // we set this flag to prevent from setting scalar value changing quantity values.
     this.isUpdatingScalarValue = true;
     var value = quantity != null
         ? this.Unit.GetScalarValue(quantity.Value)
         : (double?)null;
     this.SetCurrentValue(property, value);
     this.isUpdatingScalarValue = false;
 }
 protected virtual void OnMaxValueChanged(Stiffness? oldValue, Stiffness? newValue)
 {
     this.SetScalarValue(ScalarMaxValueProperty, newValue);
 }