Пример #1
0
 /// <summary>
 /// Constructor to create a ModelSection.
 /// </summary>
 /// <param name="pos">Position parameter (0-1).</param>
 /// <param name="section">Cross-section at pos.</param>
 /// <param name="eccentricity">Eccentricity at pos.</param>
 internal ComplexSectionPart(double pos, Section section, Bars.Eccentricity eccentricity)
 {
     this.Pos          = pos;
     this.SectionRef   = section.Guid;
     this.SectionObj   = section;
     this.Eccentricity = eccentricity;
     this.End          = "";
 }
Пример #2
0
        /// <summary>
        /// Create complex section from sections and eccentricity
        /// </summary>
        internal ComplexSection(Section[] sections, Bars.Eccentricity[] eccentricities)
        {
            // sections
            var mySections = new Section[2];

            if (sections.Length == 1)
            {
                // create new list with start/end section
                mySections = new Section[2] {
                    sections[0], sections[0]
                };
            }
            else if (sections.Length == 2)
            {
                mySections = sections;
            }
            else
            {
                throw new System.ArgumentException($"Length of sections: {sections.Length}, must be 1 (uniform) or 2 (start/end section)");
            }

            // eccentricities
            var myEccentricities = new Bars.Eccentricity[2];

            if (eccentricities.Length == 1)
            {
                // create new list with start/end section
                myEccentricities = new Bars.Eccentricity[2] {
                    eccentricities[0], eccentricities[0]
                };
            }
            else if (eccentricities.Length == 2)
            {
                myEccentricities = eccentricities;
            }
            else
            {
                throw new System.ArgumentException($"Length of eccentricities: {eccentricities.Length}, must be 1 (uniform) or 2 (start/end eccentricity)");
            }

            // construct complex section
            var myPositions = new double[2] {
                0, 1
            };

            if (mySections.Length == myPositions.Length && myPositions.Length == myEccentricities.Length)
            {
                this.EntityCreated();
                for (int idx = 0; idx < mySections.Length; idx++)
                {
                    this.Parts.Add(new ComplexSectionPart(myPositions[idx], mySections[idx], myEccentricities[idx]));
                }
            }
            else
            {
                throw new System.ArgumentException($"Input arguments have different length. sections: {sections.Length}, positions: {myPositions.Length}, eccentricities: {eccentricities.Length}");
            }
        }
Пример #3
0
 /// <summary>
 /// Create complex section from a start and end section and eccentricity.
 /// </summary>
 internal ComplexSection(Section startSection, Section endSection, Bars.Eccentricity startEccentricity, Bars.Eccentricity endEccentricity)
 {
     this.EntityCreated();
     this.Parts.Add(new ComplexSectionPart(0, startSection, startEccentricity));
     this.Parts.Add(new ComplexSectionPart(1, endSection, endEccentricity));
 }
Пример #4
0
 /// <summary>
 /// Create simple complex section from section and eccentricity. Equal cross-section and eccentricity at both ends of bar.
 /// </summary>
 /// <param name="section">Cross-section</param>
 /// <param name="eccentricity">Eccentricity</param>
 internal ComplexSection(Section section, Bars.Eccentricity eccentricity)
 {
     this.EntityCreated();
     this.Parts.Add(new ComplexSectionPart(0, section, eccentricity));
     this.Parts.Add(new ComplexSectionPart(1, section, eccentricity));
 }