Esempio n. 1
0
        public void Edit_AddLoadCase()
        {
            // Launch SAP2000v16 and Open a blank model

            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\2a_Dome.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();
            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;
            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);

            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_4b_Read_Edit_AddLoadCase.dyn");

            // Test Logic is here --->
            //check for errors and assert accordingly
            string failreport = CompileErrorsIntoString();

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel = null;

            if (string.IsNullOrEmpty(failreport))
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail(failreport);
            }
        }
Esempio n. 2
0
        public static void InitializeSapModel(ref SapObject mySAPObject, ref cSapModel mySapModel, string units)
        {
            long ret = 0;

            //TO DO: Grab open Instance if already open!!!

            //Create SAP2000 Object
            mySAPObject = new SAP2000v16.SapObject();

            // get enum from Units
            eUnits Units = (eUnits)Enum.Parse(typeof(eUnits), units);

            //Start Application
            mySAPObject.ApplicationStart(Units, true);

            //Create SapModel object
            mySapModel = mySAPObject.SapModel;

            //initialize the model
            ret = mySapModel.InitializeNewModel(Units);

            //create new blank model
            ret = mySapModel.File.NewBlank();

            //SET UP ... SET UP ... SET UP ... SET UP
            DefineMaterials(ref mySapModel);
        }
Esempio n. 3
0
        public void ReadStructure_Frame()
        {
            // Launch SAP2000v16 and Open a blank model

            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\2a_Dome.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();

            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;

            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);


            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_2a_Read_Dome+DecomposeSapModel.dyn");

            // Test Logic is here --->
            string failreport = string.Empty;

            // Check Node Read SAp Model
            if (IsNodeInErrorOrWarningState("966718c2-c618-46b8-b631-c43a54c669ff"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Read.SAPModel" + "' failed or threw a warning.");
            }

            // Check Node Structural Model Decompose
            if (IsNodeInErrorOrWarningState("36b32253-13f6-47ab-9bef-69b45c688c5b"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "StructuralModel.Decompose" + "' failed or threw a warning.");
            }

            // Check Node Frame Decompose
            if (IsNodeInErrorOrWarningState("b5e32685-6c44-443b-bc6c-c91a051cc541"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Frame.Decompose" + "' failed or threw a warning.");
            }

            // Check Node SectionProp.Decompose
            if (IsNodeInErrorOrWarningState("6bdba7f9-4de1-475e-8868-815d93b99bf6"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "SectionProp.Decompose" + "' failed or threw a warning.");
            }

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel  = null;

            if (!string.IsNullOrEmpty(failreport))
            {
                Assert.Fail(failreport);
            }

            //if we got here, nothing failed.
            Assert.Pass();
        }
Esempio n. 4
0
        public void ReadStructure_Shell()
        {
            // Launch SAP2000v16 and Open a blank model
            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\2b_SimpleShellStructure.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();

            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;

            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);

            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_2b_Read_Shell+DecomposeSapModel.dyn");

            // Test Logic is here --->
            string failreport = string.Empty;

            // Check Node Read SAp Model
            if (IsNodeInErrorOrWarningState("966718c2-c618-46b8-b631-c43a54c669ff"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Read.SAPModel" + "' failed or threw a warning.");
            }

            // Check Node Structural Model Decompose
            if (IsNodeInErrorOrWarningState("36b32253-13f6-47ab-9bef-69b45c688c5b"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "StructuralModel.Decompose" + "' failed or threw a warning.");
            }

            // Check Node Shell Decompose
            if (IsNodeInErrorOrWarningState("c6ec73e3-9413-4464-b827-a4195d68c727"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Frame.Decompose" + "' failed or threw a warning.");
            }

            // Check Node ShellProp.Decompose
            if (IsNodeInErrorOrWarningState("398af6ae-6adc-4f34-83f0-ef85184f37bb"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "ShellProp.Decompose" + "' failed or threw a warning.");
            }

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel  = null;

            if (!string.IsNullOrEmpty(failreport))
            {
                Assert.Fail(failreport);
            }

            //if we got here, nothing failed.
            Assert.Pass();
        }
Esempio n. 5
0
        public static void OpenSAPModel(string filePath, ref cSapModel mySapModel, ref string units)
        {
            long ret = 0;
            //Create SAP2000 Object
            SapObject mySAPObject = new SAP2000v16.SapObject();

            //Start Application
            mySAPObject.ApplicationStart();
            //Create SapModel object
            mySapModel = mySAPObject.SapModel;
            ret        = mySapModel.InitializeNewModel();
            ret        = mySapModel.File.OpenFile(filePath);
            units      = mySapModel.GetPresentUnits().ToString();
        }
Esempio n. 6
0
        public void Edit_AddLoadCase()
        {
            // Launch SAP2000v16 and Open a blank model

            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\2a_Dome.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();

            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;

            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);


            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_4b_Read_Edit_AddLoadCase.dyn");

            // Test Logic is here --->
            //check for errors and assert accordingly
            string failreport = CompileErrorsIntoString();

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel  = null;

            if (string.IsNullOrEmpty(failreport))
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail(failreport);
            }
        }
Esempio n. 7
0
        public void RunAnalysis()
        {
            // Launch SAP2000v16 and Open a blank model
            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\3a_RunAnalysis.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();
            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;
            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);

            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_3a_RunAnalysis_ReadResults.dyn");

            // Test Logic is here --->
            string failreport = string.Empty;

            // Check Node Run Analysis
            if (IsNodeInErrorOrWarningState("b24e8e64-0cc1-43a1-a98c-3bfcf4f9099e"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.Run" + "' failed or threw a warning.");
            }

            // Check Node StructuralModel.Decompose
            if (IsNodeInErrorOrWarningState("79d1b8d0-0bb8-498b-b40b-cc5de1b168b7"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "StructuralModel.Decompose" + "' failed or threw a warning.");
            }

            // Check Node Frame.DisplayLoads
            if (IsNodeInErrorOrWarningState("6ba73349-8d06-4f1f-ba4f-d3d23f59bba4"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Frame.DisplayLoads" + "' failed or threw a warning.");
            }

            // Check Node Analysis.GetResults
            if (IsNodeInErrorOrWarningState("39d253c0-b3fc-4e82-9c74-5e645578bab3"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.GetResults" + "' failed or threw a warning.");
            }

            // Check dropdown Force Type
            var forceType = (string)GetPreviewValue("a1a18410-1bf5-4492-8bad-40faee974fe9");
            if (forceType != "Axial") failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Force Type Dropdown" + "' returns wrong value !");

            // Check Node Analysis.Decomposeresults
            if (IsNodeInErrorOrWarningState("80e7a42a-1418-471f-b368-551fd3752e8d"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.DecomposeResults" + "' failed or threw a warning.");
            }

            // Check Node Analysis.VisualizeResults
            if (IsNodeInErrorOrWarningState("982cd2d8-aa2a-473b-9d6b-ed6f11ed29c4"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.VisualizeResults" + "' failed or threw a warning.");
            }

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel = null;

            if (!string.IsNullOrEmpty(failreport))
            {
                Assert.Fail(failreport);
            }

            //if we got here, nothing failed.
            Assert.Pass();
        }
Esempio n. 8
0
        public void ReadStructure_Shell()
        {
            // Launch SAP2000v16 and Open a blank model
            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\2b_SimpleShellStructure.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();
            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;
            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);

            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_2b_Read_Shell+DecomposeSapModel.dyn");

            // Test Logic is here --->
            string failreport = string.Empty;

            // Check Node Read SAp Model
            if (IsNodeInErrorOrWarningState("966718c2-c618-46b8-b631-c43a54c669ff"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Read.SAPModel" + "' failed or threw a warning.");
            }

            // Check Node Structural Model Decompose
            if (IsNodeInErrorOrWarningState("36b32253-13f6-47ab-9bef-69b45c688c5b"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "StructuralModel.Decompose" + "' failed or threw a warning.");
            }

            // Check Node Shell Decompose
            if (IsNodeInErrorOrWarningState("c6ec73e3-9413-4464-b827-a4195d68c727"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Frame.Decompose" + "' failed or threw a warning.");
            }

            // Check Node ShellProp.Decompose
            if (IsNodeInErrorOrWarningState("398af6ae-6adc-4f34-83f0-ef85184f37bb"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "ShellProp.Decompose" + "' failed or threw a warning.");
            }

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel = null;

            if (!string.IsNullOrEmpty(failreport))
            {
                Assert.Fail(failreport);
            }

            //if we got here, nothing failed.
            Assert.Pass();
        }
Esempio n. 9
0
        public void ReadStructure_Frame()
        {
            // Launch SAP2000v16 and Open a blank model

            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\2a_Dome.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();
            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;
            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);

            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_2a_Read_Dome+DecomposeSapModel.dyn");

            // Test Logic is here --->
            string failreport = string.Empty;

            // Check Node Read SAp Model
            if (IsNodeInErrorOrWarningState("966718c2-c618-46b8-b631-c43a54c669ff"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Read.SAPModel" + "' failed or threw a warning.");
            }

            // Check Node Structural Model Decompose
            if (IsNodeInErrorOrWarningState("36b32253-13f6-47ab-9bef-69b45c688c5b"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "StructuralModel.Decompose" + "' failed or threw a warning.");
            }

            // Check Node Frame Decompose
            if (IsNodeInErrorOrWarningState("b5e32685-6c44-443b-bc6c-c91a051cc541"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Frame.Decompose" + "' failed or threw a warning.");
            }

            // Check Node SectionProp.Decompose
            if (IsNodeInErrorOrWarningState("6bdba7f9-4de1-475e-8868-815d93b99bf6"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "SectionProp.Decompose" + "' failed or threw a warning.");
            }

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel = null;

            if (!string.IsNullOrEmpty(failreport))
            {
                Assert.Fail(failreport);
            }

            //if we got here, nothing failed.
            Assert.Pass();
        }
Esempio n. 10
0
        public void RunAnalysis()
        {
            // Launch SAP2000v16 and Open a blank model
            string filePath = @"C:\Users\eertugrul\Documents\GitHub\DynamoSAP\packages\DynamoSAP\extra\3a_RunAnalysis.sdb";
            //Create SAP2000 Object
            SapObject mySapObject = new SAP2000v16.SapObject();

            //Start Application
            mySapObject.ApplicationStart();
            //Create SapModel object
            cSapModel mySapModel = mySapObject.SapModel;

            mySapModel.InitializeNewModel();
            mySapModel.File.OpenFile(filePath);

            //Open and Run the sample file
            OpenAndRunDynamoDefinition(@".\Sample_3a_RunAnalysis_ReadResults.dyn");

            // Test Logic is here --->
            string failreport = string.Empty;

            // Check Node Run Analysis
            if (IsNodeInErrorOrWarningState("b24e8e64-0cc1-43a1-a98c-3bfcf4f9099e"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.Run" + "' failed or threw a warning.");
            }

            // Check Node StructuralModel.Decompose
            if (IsNodeInErrorOrWarningState("79d1b8d0-0bb8-498b-b40b-cc5de1b168b7"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "StructuralModel.Decompose" + "' failed or threw a warning.");
            }

            // Check Node Frame.DisplayLoads
            if (IsNodeInErrorOrWarningState("6ba73349-8d06-4f1f-ba4f-d3d23f59bba4"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Frame.DisplayLoads" + "' failed or threw a warning.");
            }

            // Check Node Analysis.GetResults
            if (IsNodeInErrorOrWarningState("39d253c0-b3fc-4e82-9c74-5e645578bab3"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.GetResults" + "' failed or threw a warning.");
            }

            // Check dropdown Force Type
            var forceType = (string)GetPreviewValue("a1a18410-1bf5-4492-8bad-40faee974fe9");

            if (forceType != "Axial")
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Force Type Dropdown" + "' returns wrong value !");
            }

            // Check Node Analysis.Decomposeresults
            if (IsNodeInErrorOrWarningState("80e7a42a-1418-471f-b368-551fd3752e8d"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.DecomposeResults" + "' failed or threw a warning.");
            }

            // Check Node Analysis.VisualizeResults
            if (IsNodeInErrorOrWarningState("982cd2d8-aa2a-473b-9d6b-ed6f11ed29c4"))
            {
                failreport = string.Format(failreport + "{0}{1}", Environment.NewLine, "The node called '" + "Analysis.VisualizeResults" + "' failed or threw a warning.");
            }

            // Set SAP instances to null;
            mySapObject.ApplicationExit(false);
            mySapObject = null;
            mySapModel  = null;

            if (!string.IsNullOrEmpty(failreport))
            {
                Assert.Fail(failreport);
            }

            //if we got here, nothing failed.
            Assert.Pass();
        }