/// <summary>
        /// Returns the load data for the specified load case.
        /// </summary>
        /// <param name="name">The name of an existing steady state load case.</param>
        /// <param name="loadDirections">U1, U2, U3, R1, R2 or R3, indicating the direction of each load.</param>
        /// <param name="functions">The name of the steady state function associated with each load.</param>
        /// <param name="scaleFactor">The scale factor of each load assigned to the load case. [L/s^2] for U1 U2 and U3; otherwise unitless.</param>
        /// <param name="coordinateSystems">This is an array that includes the name of the coordinate system associated with each load.
        /// If this item is a blank string, the Global coordinate system is assumed.</param>
        /// <param name="angles">This is an array that includes the angle between the acceleration local 1 axis and the +X-axis of the coordinate system specified by <paramref name="coordinateSystems" />.
        /// The rotation is about the Z-axis of the specified coordinate system. [deg].</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void GetLoads(string name,
                             out eDegreeOfFreedom[] loadDirections,
                             out string[] functions,
                             out double[] scaleFactor,
                             out string[] coordinateSystems,
                             out double[] angles)
        {
            functions         = new string[0];
            scaleFactor       = new double[0];
            coordinateSystems = new string[0];
            angles            = new double[0];

            string[] csiLoadDirections = new string[0];

            _callCode = _sapModel.LoadCases.ResponseSpectrum.GetLoads(name,
                                                                      ref _numberOfItems,
                                                                      ref csiLoadDirections,
                                                                      ref functions,
                                                                      ref scaleFactor,
                                                                      ref coordinateSystems,
                                                                      ref angles);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }

            loadDirections = new eDegreeOfFreedom[_numberOfItems - 1];
            for (int i = 0; i < _numberOfItems; i++)
            {
                loadDirections[i] = EnumLibrary.ConvertStringToEnumByDescription <eDegreeOfFreedom>(csiLoadDirections[i]);
            }
        }
Esempio n. 2
0
        public void ConvertStringToEnumByXMLAttribute_of_Nonexisting_Enum_without_Attribute_Returns_FirstEnum()
        {
            EnumWithAttribute expectedEnum = 0;
            EnumWithAttribute testEnum     = EnumLibrary.ConvertStringToEnumByXMLAttribute <EnumWithAttribute>("nonexistentEnum");

            Assert.AreEqual(expectedEnum, testEnum);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates a new template model of a 3D Frame.
 /// Do not use this function to add to an existing model.
 /// This function should be used only for creating a new model and typically would be preceded by calls to ApplicationStart or InitializeNewModel.
 /// </summary>
 /// <param name="templateType">Template type.</param>
 /// <param name="numberStories">The number of stories.</param>
 /// <param name="storyHeight">Height of each story. [L]</param>
 /// <param name="numberBaysX">The number bays along the global x-direction.</param>
 /// <param name="numberBaysY">The number bays along the global y-direction.</param>
 /// <param name="bayWidthX">Width of each bay along the global x-direction. [L]</param>
 /// <param name="bayWidthY">Width of each bay along the global y-direction. [L]</param>
 /// <param name="restraint">True: Joint restraints are provided at the base of the frame.</param>
 /// <param name="beam">The frame section property used for all beams in the frame.
 /// This must either be Default or the name of a defined frame section property.</param>
 /// <param name="column">The frame section property used for all columns in the frame.
 /// This must either be Default or the name of a defined frame section property.</param>
 /// <param name="area">The shell section property used for all floor slabs in the frame.
 /// This must either be Default or the name of a defined shell section property.
 /// This item does not apply when <paramref name="templateType" /> = <see cref="e3DFrameType.OpenFrame" /> or <see cref="e3DFrameType.PerimeterFrame" />.</param>
 /// <param name="numberXDivisions">The number of divisions for each floor area object in the global x-direction.
 /// This item does not apply when <paramref name="templateType" /> = <see cref="e3DFrameType.OpenFrame" /> or <see cref="e3DFrameType.PerimeterFrame" />.</param>
 /// <param name="numberYDivisions">The number of divisions for each floor area object in the global y-direction.
 /// This item does not apply when <paramref name="templateType" /> = <see cref="e3DFrameType.OpenFrame" /> or <see cref="e3DFrameType.PerimeterFrame" />.</param>
 /// <exception cref="MPT.CSI.API.Core.Support.CSiException"></exception>
 public void New3DFrame(e3DFrameType templateType,
                        int numberStories,
                        double storyHeight,
                        int numberBaysX, int numberBaysY,
                        double bayWidthX, double bayWidthY,
                        bool restraint       = true,
                        string beam          = "Default",
                        string column        = "Default",
                        string area          = "Default",
                        int numberXDivisions = 4, int numberYDivisions = 4)
 {
     _callCode = _sapModel.File.New3DFrame(EnumLibrary.Convert <e3DFrameType, CSiProgram.e3DFrameType>(templateType),
                                           numberStories,
                                           storyHeight,
                                           numberBaysX, bayWidthX,
                                           numberBaysY, bayWidthY,
                                           restraint,
                                           beam, column, area,
                                           numberXDivisions, numberYDivisions);
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException(API_DEFAULT_ERROR_CODE);
     }
     resetPaths();
 }
Esempio n. 4
0
        public async Task ValidateForUpdate(int id, UserForUpdateDto userForUpdate)
        {
            Validate(userForUpdate);

            var user = await _uow.Repository <Domain.Entities.User>().FindOneAsync(new UserWithRolesSpecification(id));

            AddValidationErrorIfValueIsNull(user, "User", $"Id {id} not found");

            AddValidationErrorIfIdDoesntExist(userForUpdate.RoleIds.ToList(), EnumLibrary.GetIntValuesFromEnumType(typeof(Roles)), "Role", "Id __id__ not found");

            ThrowValidationErrorsIfNotEmpty();

            var loggedUser = await _uow.Repository <Domain.Entities.User>().FindOneAsync(new UserWithRolesSpecification((int)_currentUserService.UserId));

            var isLoggedUserAdmin = loggedUser.Roles.Any(x => x.RoleId == (int)Roles.Admin);

            var roles = user.Roles.Select(x => x.Role);

            /* if the logged user is not admin and is trying to update someones roles
             * or the user is trying to update his roles, throw 403 forbidden */
            if ((!isLoggedUserAdmin || _currentUserService.UserId == id) &&
                (!roles.Select(x => x.Id).All(userForUpdate.RoleIds.Contains) ||
                 roles.Count() != userForUpdate.RoleIds.Count()))
            {
                throw new ForbiddenException();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// This function starts the application.
        /// When the model is not visible it does not appear on screen and it does not appear in the Windows task bar.
        /// If no filename is specified, you can later open a model or create a model through the API.
        /// The file name must have an .sdb, .$2k, .s2k, .xls, or .mdb extension.
        /// Files with .sdb extensions are opened as standard SAP2000 files.
        /// Files with .$2k and .s2k extensions are imported as text files.
        /// Files with .xls extensions are imported as Microsoft Excel files.
        /// Files with .mdb extensions are imported as Microsoft Access files.
        /// </summary>
        /// <param name="units">The database units used when a new model is created.
        /// Data is internally stored in the program in the database units.</param>
        /// <param name="visible">True: The application is visible when started.
        /// False: The application is hidden when started.</param>
        /// <param name="modelPath">The full path of a model file to be opened when the application is started.
        /// If no file name is specified, the application starts without loading an existing model.</param>
        /// <exception cref="CSiException">API_DEFAULT_ERROR_CODE</exception>
        private void applicationStart(eUnits units     = eUnits.kip_in_F,
                                      bool visible     = true,
                                      string modelPath = "")
        {
#if BUILD_ETABS2015 || BUILD_ETABS2016 || BUILD_ETABS2017
            _callCode = _sapObject.ApplicationStart();
            if (_seed == null)
            {
                return;
            }

            Model.InitializeNewModel(units);
            if (!string.IsNullOrWhiteSpace(modelPath))
            {
                Model.File.Open(modelPath);
            }
            if (!visible)
            {
                Hide();
            }
#else
            _callCode = _sapObject.ApplicationStart(EnumLibrary.Convert <eUnits, CSiProgram.eUnits>(units), visible, modelPath);
#endif
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }
        }
Esempio n. 6
0
 private void ValidateEntityType(int entityType)
 {
     if (!EnumLibrary.GetIntValuesFromEnumType(typeof(EntityTypes)).Contains(entityType))
     {
         AddValidationError("Photo", $"EntityTypeId {entityType} is not valid!");
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Retrieves summary results for concrete design of joints.
 /// </summary>
 /// <param name="name">The name of an existing frame object or group, depending on the value of the ItemType item.</param>
 /// <param name="numberItems">The number of frame objects for which results are obtained.</param>
 /// <param name="frameName">This is an array that includes each frame object name for which results are obtained.</param>
 /// <param name="LCJSRatioMajor">This is an array that includes the name of the design combination for which the controlling joint shear ratio associated with the column major axis occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="JSRatioMajor">This is an array that includes the joint shear ratio associated with the column major axis.
 /// This is the joint shear divided by the joint shear capacity.</param>
 /// <param name="LCJSRatioMinor">This is an array that includes the name of the design combination for which the controlling joint shear ratio associated with the column minor axis occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="JSRatioMinor">This is an array that includes the joint shear ratio associated with the column minor axis.
 /// This is the joint shear divided by the joint shear capacity.</param>
 /// <param name="LCBCCRatioMajor">This is an array that includes the name of the design combination for which the controlling beam/column capacity ratio associated with the column major axis occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="BCCRatioMajor">This is an array that includes the beam/column capacity ratio associated with the column major axis.
 /// This is the sum of the column capacities divided by the sum of the beam capacities at the top of the specified column.</param>
 /// <param name="LCBCCRatioMinor">This is an array that includes the name of the design combination for which the controlling beam/column capacity ratio associated with the column minor axis occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="BCCRatioMinor">This is an array that includes the beam/column capacity ratio associated with the column minor axis. This is the sum of the column capacities divided by the sum of the beam capacities at the top of the specified column.</param>
 /// <param name="errorSummary">This is an array that includes the design error messages for the frame object, if any.</param>
 /// <param name="warningSummary">This is an array that includes the design warning messages for the frame object, if any.</param>
 /// <param name="itemType">This is one of the following items in the eItemType enumeration.
 /// If this item is Object, the design results are retrieved for the frame object specified by the Name item.
 /// If this item is Group, the design results are retrieved for all frame objects in the group specified by the Name item.
 /// If this item is SelectedObjects, the design results are retrieved for all selected frame objects, and the Name item is ignored.</param>
 /// <exception cref="CSiException"></exception>
 public void GetSummaryResultsJoint(string name,
                                    ref int numberItems,
                                    ref string[] frameName,
                                    ref string[] LCJSRatioMajor,
                                    ref double[] JSRatioMajor,
                                    ref string[] LCJSRatioMinor,
                                    ref double[] JSRatioMinor,
                                    ref string[] LCBCCRatioMajor,
                                    ref double[] BCCRatioMajor,
                                    ref string[] LCBCCRatioMinor,
                                    ref double[] BCCRatioMinor,
                                    ref string[] errorSummary,
                                    ref string[] warningSummary,
                                    eItemType itemType = eItemType.Object)
 {
     _callCode = _sapModel.DesignConcrete.GetSummaryResultsJoint(name,
                                                                 ref numberItems, ref frameName,
                                                                 ref LCJSRatioMajor, ref JSRatioMajor, ref LCJSRatioMinor, ref JSRatioMinor, ref LCBCCRatioMajor,
                                                                 ref BCCRatioMajor, ref LCBCCRatioMinor, ref BCCRatioMinor, ref errorSummary, ref warningSummary,
                                                                 EnumLibrary.Convert <eItemType, CSiProgram.eItemType>(itemType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
        // === Get ===
        /// <summary>
        /// Retrieves summary results for frame design.
        /// </summary>
        /// <param name="name">The name of an existing frame object or group, depending on the value of the ItemType item.</param>
        /// <param name="frameNames">This is an array that includes each frame object name for which results are obtained.</param>
        /// <param name="ratios">This is an array that includes the controlling stress or capacity ratio for each frame object.</param>
        /// <param name="ratioTypes">This is an array that includes the controlling stress or capacity ratio type for each frame object.</param>
        /// <param name="locations">This is an array that includes the distance from the I-end of the frame object to the location where the controlling stress or capacity ratio occurs. [L]</param>
        /// <param name="comboNames">This is an array that includes the name of the design combination for which the controlling stress or capacity ratio occurs.</param>
        /// <param name="errorSummaries">This is an array that includes the design error messages for the frame object, if any.</param>
        /// <param name="warningSummaries">This is an array that includes the design warning messages for the frame object, if any.</param>
        /// <param name="itemType">This is one of the following items in the eItemType enumeration: Object = 0, Group = 1, SelectedObjects = 2
        /// If this item is Object, the design results are retrieved for the frame object specified by the Name item.
        /// If this item is Group, the design results are retrieved for all frame objects in the group specified by the Name item.
        /// If this item is SelectedObjects, the design results are retrieved for all selected frame objects, and the Name item is ignored.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void GetSummaryResults(string name,
                                      out string[] frameNames,
                                      out double[] ratios,
                                      out eRatioType[] ratioTypes,
                                      out double[] locations,
                                      out string[] comboNames,
                                      out string[] errorSummaries,
                                      out string[] warningSummaries,
                                      eItemType itemType = eItemType.Object)
        {
            frameNames       = new string[0];
            ratios           = new double[0];
            locations        = new double[0];
            comboNames       = new string[0];
            errorSummaries   = new string[0];
            warningSummaries = new string[0];
            int[] csiRatioTypes = new int[0];

            _callCode = _sapModel.DesignSteel.GetSummaryResults(name, ref _numberOfItems,
                                                                ref frameNames, ref ratios, ref csiRatioTypes, ref locations, ref comboNames,
                                                                ref errorSummaries, ref warningSummaries,
                                                                EnumLibrary.Convert <eItemType, CSiProgram.eItemType>(itemType));
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }

            ratioTypes = new eRatioType[csiRatioTypes.Length];
            for (int i = 0; i < csiRatioTypes.Length; i++)
            {
                ratioTypes[i] = (eRatioType)csiRatioTypes[i];
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Retrieves summary results for concrete design of columns.
 /// </summary>
 /// <param name="name">The name of an existing frame object or group, depending on the value of the ItemType item.</param>
 /// <param name="numberItems">The number of frame objects for which results are obtained.</param>
 /// <param name="frameName">This is an array that includes each frame object name for which results are obtained.</param>
 /// <param name="myOption">This is an array that includes 1 or 2, indicating the design option for each frame object: 1 = Check, 2 = Design</param>
 /// <param name="location">This is an array that includes the distance from the I-end of the frame object to the location where the results are reported. [L]</param>
 /// <param name="PMMCombo">This is an array that includes the name of the design combination for which the controlling PMM ratio or rebar area occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="PMMArea">This is an array that includes the total longitudinal rebar area required for the axial force plus biaxial moment (PMM) design at the specified location. [L^2]</param>
 /// <param name="PMMRatio">This is an array that includes the axial force plus biaxial moment (PMM) stress ratio at the specified location.
 /// Item applies only when MyOption = 1 (check).</param>
 /// <param name="VMajorCombo">This is an array that includes the name of the design combination for which the controlling major shear occurs.</param>
 /// <param name="AVMajor">This is an array that includes the required area of transverse shear reinforcing per unit length along the frame object for major shear at the specified location. [L^2/L]</param>
 /// <param name="VMinorCombo">This is an array that includes the name of the design combination for which the controlling minor shear occurs.</param>
 /// <param name="AVMinor">This is an array that includes the required area of transverse shear reinforcing per unit length along the frame object for minor shear at the specified location. [L^2/L]</param>
 /// <param name="errorSummary">This is an array that includes the design error messages for the frame object, if any.</param>
 /// <param name="warningSummary">This is an array that includes the design warning messages for the frame object, if any.</param>
 /// <param name="itemType">This is one of the following items in the eItemType enumeration.
 /// If this item is Object, the design results are retrieved for the frame object specified by the Name item.
 /// If this item is Group, the design results are retrieved for all frame objects in the group specified by the Name item.
 /// If this item is SelectedObjects, the design results are retrieved for all selected frame objects, and the Name item is ignored.</param>
 /// <exception cref="CSiException"></exception>
 public void GetSummaryResultsColumn(string name,
                                     ref int numberItems,
                                     ref string[] frameName,
                                     ref int[] myOption,
                                     ref double[] location,
                                     ref string[] PMMCombo,
                                     ref double[] PMMArea,
                                     ref double[] PMMRatio,
                                     ref string[] VMajorCombo,
                                     ref double[] AVMajor,
                                     ref string[] VMinorCombo,
                                     ref double[] AVMinor,
                                     ref string[] errorSummary,
                                     ref string[] warningSummary,
                                     eItemType itemType = eItemType.Object)
 {
     _callCode = _sapModel.DesignConcrete.GetSummaryResultsColumn(name, ref numberItems,
                                                                  ref frameName, ref myOption, ref location,
                                                                  ref PMMCombo, ref PMMArea, ref PMMRatio, ref VMajorCombo, ref AVMajor, ref VMinorCombo, ref AVMinor,
                                                                  ref errorSummary, ref warningSummary,
                                                                  EnumLibrary.Convert <eItemType, CSiProgram.eItemType>(itemType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Retrieves summary results for concrete design of beams.
 /// Torsion results are not included for all codes.
 /// </summary>
 /// <param name="name">The name of an existing frame object or group, depending on the value of the ItemType item.</param>
 /// <param name="numberItems">The number of frame objects for which results are obtained.</param>
 /// <param name="frameName">This is an array that includes each frame object name for which results are obtained.</param>
 /// <param name="location">This is an array that includes the distance from the I-end of the frame object to the location where the results are reported. [L]</param>
 /// <param name="topCombo">This is an array that includes the name of the design combination for which the controlling top longitudinal rebar area for flexure occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="topArea">This is an array that includes the total top longitudinal rebar area required for the flexure at the specified location.
 /// It does not include the area of steel required for torsion. [L^2]</param>
 /// <param name="botCombo">This is an array that includes the name of the design combination for which the controlling bottom longitudinal rebar area for flexure occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific, multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="botArea">This is an array that includes the total bottom longitudinal rebar area required for the flexure at the specified location.
 /// It does not include the area of steel required for torsion. [L^2]</param>
 /// <param name="VMajorCombo">This is an array that includes the name of the design combination for which the controlling shear occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific, multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="VMajorArea">This is an array that includes the required area of transverse shear reinforcing per unit length along the frame object for shear at the specified location. [L^2/L]</param>
 /// <param name="TLCombo">This is an array that includes the name of the design combination for which the controlling longitudinal rebar area for torsion occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific, multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="TLArea">This is an array that includes the total longitudinal rebar area required for torsion. [L^2]</param>
 /// <param name="TTCombo">This is an array that includes the name of the design combination for which the controlling transverse reinforcing for torsion occurs.
 /// A combination name followed by (Sp) indicates that the design loads were obtained by applying special, code-specific, multipliers to all or part of the specified design load combination, or that the design was based on the capacity of other objects (or other design locations for the same object).</param>
 /// <param name="TTArea">This is an array that includes the required area of transverse torsional shear reinforcing per unit length along the frame object for torsion at the specified location. [L^2/L]</param>
 /// <param name="errorSummary">This is an array that includes the design error messages for the frame object, if any.</param>
 /// <param name="warningSummary">This is an array that includes the design warning messages for the frame object, if any.</param>
 /// <param name="itemType">This is one of the following items in the eItemType enumeration.
 /// If this item is Object, the design results are retrieved for the frame object specified by the Name item.
 /// If this item is Group, the design results are retrieved for all frame objects in the group specified by the Name item.
 /// If this item is SelectedObjects, the design results are retrieved for all selected frame objects, and the Name item is ignored.</param>
 /// <exception cref="CSiException"></exception>
 public void GetSummaryResultsBeam(string name,
                                   ref int numberItems,
                                   ref string[] frameName,
                                   ref double[] location,
                                   ref string[] topCombo,
                                   ref double[] topArea,
                                   ref string[] botCombo,
                                   ref double[] botArea,
                                   ref string[] VMajorCombo,
                                   ref double[] VMajorArea,
                                   ref string[] TLCombo,
                                   ref double[] TLArea,
                                   ref string[] TTCombo,
                                   ref double[] TTArea,
                                   ref string[] errorSummary,
                                   ref string[] warningSummary,
                                   eItemType itemType = eItemType.Object)
 {
     _callCode = _sapModel.DesignConcrete.GetSummaryResultsBeam(name, ref numberItems,
                                                                ref frameName, ref location,
                                                                ref topCombo, ref topArea, ref botCombo, ref botArea, ref VMajorCombo, ref VMajorArea,
                                                                ref TLCombo, ref TLArea, ref TTCombo, ref TTArea,
                                                                ref errorSummary, ref warningSummary,
                                                                EnumLibrary.Convert <eItemType, CSiProgram.eItemType>(itemType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Returns the load data for the specified load case.
        /// </summary>
        /// <param name="name">The name of an existing steady state load case.</param>
        /// <param name="loadTypes">Either <see cref="eLoadType.Load" /> or <see cref="eLoadType.Accel" />, indicating the type of each load assigned to the load case.</param>
        /// <param name="loadNames">The name of each load assigned to the load case.
        /// If <paramref name="loadTypes" /> = <see cref="eLoadType.Load" />, this item is the name of a defined load pattern.
        /// If <paramref name="loadTypes" /> = <see cref="eLoadType.Accel" />, this item is U1, U2, U3, R1, R2 or R3, indicating the direction of the load.</param>
        /// <param name="functions">The name of the load function associated with each load.</param>
        /// <param name="scaleFactor">The scale factor of each load assigned to the load case. [L/s^2] for U1 U2 and U3; otherwise unitless.</param>
        /// <param name="timeFactor">The time scale factor of each load assigned to the load case.</param>
        /// <param name="arrivalTime">The arrival time of each load assigned to the load case.</param>
        /// <param name="coordinateSystems">This is an array that includes the name of the coordinate system associated with each load.
        /// If this item is a blank string, the Global coordinate system is assumed.
        /// This item applies only when <paramref name="loadTypes" /> = <see cref="eLoadType.Accel" />.</param>
        /// <param name="angles">This is an array that includes the angle between the acceleration local 1 axis and the +X-axis of the coordinate system specified by <paramref name="coordinateSystems" />.
        /// The rotation is about the Z-axis of the specified coordinate system. [deg].
        /// This item applies only when <paramref name="loadTypes" /> = <see cref="eLoadType.Accel" />.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void GetLoads(string name,
                             out eLoadType[] loadTypes,
                             out string[] loadNames,
                             out string[] functions,
                             out double[] scaleFactor,
                             out double[] timeFactor,
                             out double[] arrivalTime,
                             out string[] coordinateSystems,
                             out double[] angles)
        {
            loadTypes         = new eLoadType[0];
            loadNames         = new string[0];
            functions         = new string[0];
            scaleFactor       = new double[0];
            timeFactor        = new double[0];
            arrivalTime       = new double[0];
            coordinateSystems = new string[0];
            angles            = new double[0];

            string[] csiLoadTypes = new string[0];

            _callCode = _sapModel.LoadCases.DirHistNonlinear.GetLoads(name, ref _numberOfItems, ref csiLoadTypes, ref loadNames, ref functions, ref scaleFactor, ref timeFactor, ref arrivalTime, ref coordinateSystems, ref angles);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }

            loadTypes = new eLoadType[_numberOfItems - 1];
            for (int i = 0; i < _numberOfItems; i++)
            {
                loadTypes[i] = EnumLibrary.ConvertStringToEnumByDescription <eLoadType>(csiLoadTypes[i]);
            }
        }
Esempio n. 12
0
        public void ConvertStringToEnumByDescription_of_Nonexisting_Enum_without_Description_Returns_FirstEnum()
        {
            EnumWithoutDescription expectedEnum = 0;
            EnumWithoutDescription testEnum     = EnumLibrary.ConvertStringToEnumByDescription <EnumWithoutDescription>("nonexistentEnum");

            Assert.AreEqual(expectedEnum, testEnum);
        }
Esempio n. 13
0
        /// <inheritdoc />
        /// <summary>
        /// Returns the case type, design type, and auto flag for the specified load case.
        /// </summary>
        /// <param name="nameLoadCase">The name of an existing load case.</param>
        /// <param name="loadCaseType">Load case type corresponding to the name provided.</param>
        /// <param name="loadCaseSubType">Load case sub-type corresponding to the name provided.</param>
        /// <param name="designType">Load case design type corresponding to the name provided.</param>
        /// <param name="designTypeOption">Load case type corresponding to the name provided.</param>
        /// <param name="autoCreatedCase">This is a value indicating if the load case has been automatically created.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void GetCaseTypes(string nameLoadCase,
                                 out eLoadCaseType loadCaseType,
                                 out int loadCaseSubType,
                                 out eLoadPatternType designType,
                                 out eSpecificationSource designTypeOption,
                                 out eAutoCreatedCase autoCreatedCase)
        {
            loadCaseType    = 0;
            loadCaseSubType = 0;
            designType      = 0;
            CSiProgram.eLoadCaseType    csiCaseType    = CSiProgram.eLoadCaseType.Modal;
            CSiProgram.eLoadPatternType csiPatternType = CSiProgram.eLoadPatternType.Dead;

            int csiDesignTypeOption = 0;
            int csiAutoCreatedCase  = 0;

            _callCode = _sapModel.LoadCases.GetTypeOAPI_1(nameLoadCase, ref csiCaseType, ref loadCaseSubType, ref csiPatternType, ref csiDesignTypeOption, ref csiAutoCreatedCase);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }

            loadCaseType     = EnumLibrary.Convert(csiCaseType, loadCaseType);
            designType       = EnumLibrary.Convert(csiPatternType, designType);
            designTypeOption = (eSpecificationSource)csiDesignTypeOption;
            autoCreatedCase  = (eAutoCreatedCase)csiAutoCreatedCase;
        }
Esempio n. 14
0
 /// <summary>
 /// Sets the units presently specified for the model.
 /// </summary>
 /// <param name="units">The units.</param>
 /// <exception cref="CSiException"></exception>
 /// <exception cref="MPT.CSI.API.Core.Support.CSiException"></exception>
 public void SetPresentUnits(eUnits units)
 {
     _callCode = _sapModel.SetPresentUnits(EnumLibrary.Convert <eUnits, CSiProgram.eUnits>(units));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 15
0
        private void OnEnable()
        {
            _warningInfos = new GUIStyle();
            _warningInfos.normal.textColor = UnityEngine.Color.red;
            _warningInfos.fontStyle        = FontStyle.Bold;

            _manager = target as EnumLibrary;
            _manager.LoadAllEnums();
        }
Esempio n. 16
0
 /// <summary>
 /// This function clears the previous model and initializes the program for a new model.
 /// If it is later needed, you should save your previous model prior to calling this function.
 /// After calling the InitializeNewModel function, it is not necessary to also call the ApplicationStart function because the functionality of the ApplicationStart function is included in the InitializeNewModel function.
 /// </summary>
 /// <param name="units">The database units for the new model.
 /// All data is internally stored in the model in these units.</param>
 /// <returns><c>true</c> if a nuew model is successfully initialized, <c>false</c> otherwise.</returns>
 public bool InitializeNewModel(eUnits units = eUnits.kip_in_F)
 {
     _callCode = _sapModel.InitializeNewModel(EnumLibrary.Convert <eUnits, CSiProgram.eUnits>(units));
     if (!apiCallIsSuccessful(_callCode))
     {
         return(false);
     }
     _file = new CSiFile(_seed);
     return(true);
 }
 /// <summary>
 /// Sets the value of a concrete design overwrite item.
 /// </summary>
 /// <param name="name">The name of an existing frame object or group, depending on the value of the <paramref name="itemType" /> item.</param>
 /// <param name="item">The overwrite item considered.</param>
 /// <param name="value">The value of the considered overwrite item.</param>
 /// <param name="itemType">If this item is <see cref="eItemType.Object" />, the assignment is made to the frame object specified by the <paramref name="name" /> item.
 /// If this item is <see cref="eItemType.Group" />, the assignment is made to all frame objects in the group specified by the <paramref name="name" /> item.
 /// If this item is <see cref="eItemType.SelectedObjects" />, assignment is made to all selected frame objects, and the <paramref name="name" /> item is ignored.</param>
 /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
 public void SetOverwrite(string name,
     int item,
     double value,
     eItemType itemType = eItemType.Object)
 {
     _callCode = _sapModel.DesignConcrete.Italian_NTC_2008.SetOverwrite(name, 
                     (int)item, value, 
                     EnumLibrary.Convert<eItemType, CSiProgram.eItemType>(itemType));
     if (throwCurrentApiException(_callCode)) { throw new CSiException(API_DEFAULT_ERROR_CODE); }
 }
Esempio n. 18
0
 // === Set
 /// <summary>
 /// Removes the auto select section assignments from all specified frame objects that have a steel frame design procedure.
 /// </summary>
 /// <param name="itemName">Name of an existing frame object or group, depending on the value of the ItemType item.</param>
 /// <param name="itemType">Selection type to use for applying the method.</param>
 /// <exception cref="CSiException"></exception>
 public void SetAutoSelectNull(string itemName,
                               eItemType itemType = eItemType.Object)
 {
     _callCode = _sapModel.DesignSteel.SetAutoSelectNull(itemName,
                                                         EnumLibrary.Convert <eItemType, CSiProgram.eItemType>(itemType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 19
0
        public void GetIntValuesFromEnumType_PassEnum_ReturnListOfIntegers()
        {
            var enumType = typeof(TestEnums);

            var result = EnumLibrary.GetIntValuesFromEnumType(enumType);

            result.Should().Contain(1);
            result.Should().Contain(2);
            result.Should().HaveCount(2);
        }
Esempio n. 20
0
 // === Set
 /// <summary>
 /// Removes the auto select section assignments from all specified frame objects that have a steel frame design procedure.
 /// </summary>
 /// <param name="itemName">Name of an existing frame object or group, depending on the value of the ItemType item.</param>
 /// <param name="itemType">Selection type to use for applying the method.</param>
 public void SetAutoSelectNull(string itemName,
                               eItemType itemType = eItemType.Object)
 {
     _callCode = _sapModel.DesignCompositeBeam.SetAutoSelectNull(itemName,
                                                                 EnumLibrary.Convert <eItemType, CSiProgram.eItemType>(itemType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException(API_DEFAULT_ERROR_CODE);
     }
 }
Esempio n. 21
0
 /// <summary>
 /// This function starts the application.
 /// When the model is not visible it does not appear on screen and it does not appear in the Windows task bar.
 /// If no filename is specified, you can later open a model or create a model through the API.
 /// The file name must have an .sdb, .$2k, .s2k, .xls, or .mdb extension.
 /// Files with .sdb extensions are opened as standard SAP2000 files.
 /// Files with .$2k and .s2k extensions are imported as text files.
 /// Files with .xls extensions are imported as Microsoft Excel files.
 /// Files with .mdb extensions are imported as Microsoft Access files.
 /// </summary>
 /// <param name="units">The database units used when a new model is created.
 /// Data is internally stored in the program in the database units.</param>
 /// <param name="visible">True: The application is visible when started.
 /// False: The application is hidden when started.</param>
 /// <param name="filePath">The full path of a model file to be opened when the application is started.
 /// If no file name is specified, the application starts without loading an existing model.</param>
 /// <exception cref="CSiException"></exception>
 public void ApplicationStart(eUnits units    = eUnits.kip_in_F,
                              bool visible    = true,
                              string filePath = "")
 {
     _callCode = _sapObject.ApplicationStart(EnumLibrary.Convert <eUnits, CSiProgram.eUnits>(units), visible, filePath);
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 22
0
 /// <summary>
 /// This function assigns a load type to a load pattern.
 /// </summary>
 /// <param name="name">The name of an existing load pattern.</param>
 /// <param name="loadPatternType">This is one of the items in the eLoadPatternType enumeration.</param>
 /// <exception cref="CSiException"></exception>
 public void SetLoadType(string name,
                         eLoadPatternType loadPatternType)
 {
     _callCode = _sapModel.LoadPatterns.SetLoadType(name,
                                                    EnumLibrary.Convert <eLoadPatternType, CSiProgram.eLoadPatternType>(loadPatternType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 23
0
        public void GetListItemMatchingEnumByXMLAttribute_of_No_Matching_Item_Returns_Empty_String()
        {
            string        expectedResult       = "";
            List <string> nonMatchingEnumItems = new List <string>()
            {
                "Foo", "Bar", "Fie", "Fo", "Last Enum"
            };
            string actualItem = EnumLibrary.GetListItemMatchingEnumByXMLAttribute(EnumWithAttribute.firstEnum, nonMatchingEnumItems);

            Assert.AreEqual(expectedResult, actualItem);
        }
Esempio n. 24
0
 /// <summary>
 /// This function retrieves the names of all defined load cases of the specified type.
 /// </summary>
 /// <param name="numberNames">The number of load case names retrieved by the program.</param>
 /// <param name="namesOfLoadCaseType">Names of all load cases of the specified type.</param>
 /// <param name="caseType">Load case type for which names are desired.</param>
 /// <exception cref="CSiException"></exception>
 public void GetNameList(ref int numberNames,
                         ref string[] namesOfLoadCaseType,
                         eLoadCaseType caseType)
 {
     _callCode = _sapModel.LoadCases.GetNameList(ref numberNames, ref namesOfLoadCaseType,
                                                 EnumLibrary.Convert <eLoadCaseType, CSiProgram.eLoadCaseType>(caseType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException();
     }
 }
Esempio n. 25
0
        public void GetListItemMatchingEnumByXMLAttribute_of_Matching_Item_Returns_Matching_Item()
        {
            string        matchingItem = "First Enum";
            List <string> enumItems    = new List <string>()
            {
                "Foo", "Bar", "Fie", matchingItem, "Last Enum"
            };
            string actualItem = EnumLibrary.GetListItemMatchingEnumByXMLAttribute(EnumWithAttribute.firstEnum, enumItems);

            Assert.AreEqual(matchingItem, actualItem);
        }
Esempio n. 26
0
 /// <summary>
 /// This function retrieves the names of all defined load cases of the specified type.
 /// </summary>
 /// <param name="namesOfLoadCaseType">Names of all load cases of the specified type.</param>
 /// <param name="caseType">Load case type for which names are desired.</param>
 /// <exception cref="CSiException">API_DEFAULT_ERROR_CODE</exception>
 public void GetNameList(out string[] namesOfLoadCaseType,
                         eLoadCaseType caseType)
 {
     namesOfLoadCaseType = new string[0];
     _callCode           = _sapModel.LoadCases.GetNameList(ref _numberOfItems, ref namesOfLoadCaseType,
                                                           EnumLibrary.Convert <eLoadCaseType, CSiProgram.eLoadCaseType>(caseType));
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException(API_DEFAULT_ERROR_CODE);
     }
 }
Esempio n. 27
0
 /// <summary>
 /// This function adds or modifies one load case or response combination in the list of cases included in the load combination specified by the Name item.
 /// </summary>
 /// <param name="nameLoadCombo">The name of an existing load combination.</param>
 /// <param name="caseComboType">This parameter indicates whether the item is an analysis case (LoadCase) or a load combination (LoadCombo).</param>
 /// <param name="caseComboNames">This is an array of the names of the load cases or load combinations included in the load combination specified by the Name item.</param>
 /// <param name="scaleFactor">The scale factor multiplying the case or combination indicated by the caseComboNames item.</param>
 /// <exception cref="CSiException">API_DEFAULT_ERROR_CODE</exception>
 public void SetCaseList(string nameLoadCombo,
                         eCaseComboType caseComboType,
                         string caseComboNames,
                         double scaleFactor)
 {
     CSiProgram.eCNameType csiCaseComboType = EnumLibrary.Convert <eCaseComboType, CSiProgram.eCNameType>(caseComboType);
     _callCode = _sapModel.RespCombo.SetCaseList(nameLoadCombo, ref csiCaseComboType, caseComboNames, scaleFactor);
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException(API_DEFAULT_ERROR_CODE);
     }
 }
Esempio n. 28
0
 /// <summary>
 /// This function deletes one load case or load combination from the list of cases included in the specified load combination.
 /// </summary>
 /// <param name="nameLoadCombo">The name of an existing load combination.</param>
 /// <param name="caseComboType">This parameter indicates whether the item is an analysis case (LoadCase) or a load combination (LoadCombo).</param>
 /// <param name="caseComboName">The name of the load case or load combination to be deleted from the specified combination.</param>
 /// <exception cref="CSiException">API_DEFAULT_ERROR_CODE</exception>
 public void DeleteCase(string nameLoadCombo,
                        eCaseComboType caseComboType,
                        string caseComboName)
 {
     _callCode = _sapModel.RespCombo.DeleteCase(nameLoadCombo,
                                                EnumLibrary.Convert <eCaseComboType, CSiProgram.eCNameType>(caseComboType),
                                                caseComboName);
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException(API_DEFAULT_ERROR_CODE);
     }
 }
Esempio n. 29
0
        public void GetIdAndNameDictionaryOfEnumType_PassEnum_ReturnDictionary()
        {
            var enumType = typeof(TestEnums);

            var result = EnumLibrary.GetIdAndNameDictionaryOfEnumType(enumType);

            result.Should().ContainKey(1);
            result.Should().ContainKey(2);
            result.Should().ContainValue("Test1");
            result.Should().ContainValue("Test2");
            result.Should().HaveCount(2);
        }
Esempio n. 30
0
 /// <summary>
 /// This function defines a Rod constraint.
 /// If the specified name is not used for a constraint, a new constraint is defined using the specified name.
 /// If the specified name is already used for another Rod constraint, the definition of that constraint is modified.
 /// If the specified name is already used for some constraint that is not a Rod constraint, an error is returned.
 /// TODO: Handle this.
 /// </summary>
 /// <param name="nameConstraint">The name of a constraint.</param>
 /// <param name="axis">Specifies the axis in the specified coordinate system that is perpendicular to the plane of the constraint.</param>
 /// <param name="nameCoordinateSystem">The name of the coordinate system in which the constraint is defined.</param>
 /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
 public void SetRod(string nameConstraint,
                    eConstraintAxis axis        = eConstraintAxis.AutoAxis,
                    string nameCoordinateSystem = CoordinateSystems.Global)
 {
     _callCode = _sapModel.ConstraintDef.SetRod(nameConstraint,
                                                EnumLibrary.Convert <eConstraintAxis, CSiProgram.eConstraintAxis>(axis),
                                                nameCoordinateSystem);
     if (throwCurrentApiException(_callCode))
     {
         throw new CSiException(API_DEFAULT_ERROR_CODE);
     }
 }