static void Main(string[] args)
        {
            string MyAppPath = AppDomain.CurrentDomain.BaseDirectory;

            using (SCIA.OpenAPI.Environment env = new SCIA.OpenAPI.Environment(@"c:\Program Files (x86)\SCIA\Engineer19.0\", @".\temp", "1.0.0.0"))
            {
                env.RunSCIAEngineer(SCIA.OpenAPI.Environment.GuiMode.ShowWindowShow);

                SCIA.OpenAPI.EsaProject UpXmlProj = env.OpenProject(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\template.esa"));
                env.UpdateProject(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeXML, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\xml\test.xml"), UpXmlProj.ProjectID);
                UpXmlProj.CloseProject(SaveMode.SaveChangesNo);

                SCIA.OpenAPI.EsaProject UpEsaProj = env.OpenProject(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\template.esa"));
                env.UpdateProject(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeESA, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\esa\test.esa"), UpEsaProj.ProjectID);
                UpEsaProj.CloseProject(SaveMode.SaveChangesNo);

                SCIA.OpenAPI.EsaProject UpIfcProj = env.OpenProject(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\template.esa"));
                env.UpdateProject(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeIFC, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\ifc\test.ifc"), UpIfcProj.ProjectID);
                UpIfcProj.CloseProject(SaveMode.SaveChangesNo);

                SCIA.OpenAPI.EsaProject UpRevitProj = env.OpenProject(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\template.esa"));
                env.UpdateProject(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeRevit, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\revit\test.r2s"), UpRevitProj.ProjectID);
                UpRevitProj.CloseProject(SaveMode.SaveChangesNo);

                SCIA.OpenAPI.EsaProject UpTeklaProj = env.OpenProject(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\template.esa"));
                env.UpdateProject(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeTekla, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\tekla\test.t2s"), UpTeklaProj.ProjectID);
                UpTeklaProj.CloseProject(SaveMode.SaveChangesNo);

                SCIA.OpenAPI.EsaProject UpXlsxProj = env.OpenProject(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\template.esa"));
                env.UpdateProject(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeAEF, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\aef\test.xlsx"), UpXlsxProj.ProjectID);
                UpXlsxProj.CloseProject(SaveMode.SaveChangesNo);

                //==========================================================
                ApiGuid newXmlproject;
                //ApiGuid newEsaproject;
                ApiGuid newIfcproject;
                ApiGuid newRevitproject;
                ApiGuid newTeklaproject;
                ApiGuid newAefproject;

                EsaProject ImXmlpProj = env.ImportProjectFromFile(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeXML, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\xml\test.xml"), out newXmlproject);
                //ESA project cannot be "imported" into SEn...just opened //EsaProject ImpEsaProj = env.ImportProjectFromFile(System.IO.Path.Combine(MyAppPath, @"..\..\..\res\esa\test.esa"), out newEsaproject);
                EsaProject ImpIfcProj   = env.ImportProjectFromFile(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeIFC, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\ifc\test.ifc"), out newIfcproject);
                EsaProject ImpRevitProj = env.ImportProjectFromFile(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeRevit, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\revit\test.r2s"), out newRevitproject);
                EsaProject ImpTeklaProj = env.ImportProjectFromFile(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeTekla, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\tekla\test.t2s"), out newTeklaproject);
                EsaProject ImpAefProj   = env.ImportProjectFromFile(SCIA.OpenAPI.Environment.TypeOfExtProject.TypeAEF, System.IO.Path.Combine(MyAppPath, @"..\..\..\res\aef\test.xlsx"), out newAefproject);

                env.CloseAllProjects(SaveMode.SaveChangesNo);
            }
        }
        /// <summary>
        /// This method represented simple use of OpenAPI, initialization of environment, creation of model, linear calculation and reading results
        /// </summary>
        static private void RunSCIAOpenAPI_simple()
        {
            //Initialization of OpenAPI environment
            using (SCIA.OpenAPI.Environment env = new SCIA.OpenAPI.Environment(SciaEngineerFullPath, AppLogPath, "1.0.0.0"))// path to the location of your installation and temp path for logs)
            {
                //Run SCIA Engineer application
                bool openedSE = env.RunSCIAEngineer(SCIA.OpenAPI.Environment.GuiMode.ShowWindowShow);
                if (!openedSE)
                {
                    throw new InvalidOperationException($"Cannot run SCIA Engineer");
                }
                //Open project
                SCIA.OpenAPI.EsaProject proj = env.OpenProject(SciaEngineerProjecTemplate);
                if (proj == null)
                {
                    throw new InvalidOperationException($"Cannot open project");
                }

                //method which create model
                CreateModel(proj.Model);
                #region  ---------- Calculation----------
                #region Send Model to SCIA Engineer
                //Refresh model in SCIA Engineer from local ADM
                proj.Model.RefreshModel_ToSCIAEngineer();
                #endregion
                #region Calculate
                // Run calculation
                proj.RunCalculation();

                #endregion
                #endregion
                #region  ---------- Results -------------

                //Initialize Results API
                using (ResultsAPI rapi = proj.Model.InitializeResultsAPI())
                {
                    if (rapi != null)
                    {
                        //Create container for 1D results
                        Result IntFor1Db1 = new Result();
                        //Results key for internal forces on beam 1
                        ResultKey keyIntFor1Db1 = new ResultKey
                        {
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            EntityType  = eDsElementType.eDsElementType_Beam,
                            EntityName  = beamName,
                            Dimension   = eDimension.eDim_1D,
                            ResultType  = eResultType.eFemBeamInnerForces,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        };
                        //Load 1D results based on results key
                        IntFor1Db1 = rapi.LoadResult(keyIntFor1Db1);
                        if (IntFor1Db1 != null)
                        {
                            Console.WriteLine(IntFor1Db1.GetTextOutput());
                        }
                        //combination
                        //Create container for 1D results
                        Result IntFor1Db1Combi = new Result();
                        //Results key for internal forces on beam 1
                        ResultKey keyIntFor1Db1Combi = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Beam,
                            EntityName  = beamName,
                            CaseType    = eDsElementType.eDsElementType_Combination,
                            CaseId      = C1Id,
                            Dimension   = eDimension.eDim_1D,
                            ResultType  = eResultType.eFemBeamInnerForces,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        };
                        // Load 1D results based on results key
                        IntFor1Db1Combi = rapi.LoadResult(keyIntFor1Db1Combi);
                        if (IntFor1Db1Combi != null)
                        {
                            Console.WriteLine(IntFor1Db1Combi.GetTextOutput());
                        }
                        ResultKey keyReactionsSu1 = new ResultKey
                        {
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            EntityType  = eDsElementType.eDsElementType_Node,
                            EntityName  = "n1",
                            Dimension   = eDimension.eDim_reactionsPoint,
                            ResultType  = eResultType.eReactionsNodes,
                            CoordSystem = eCoordSystem.eCoordSys_Global
                        };
                        Result reactionsSu1 = new Result();
                        reactionsSu1 = rapi.LoadResult(keyReactionsSu1);
                        if (reactionsSu1 != null)
                        {
                            Console.WriteLine(reactionsSu1.GetTextOutput());
                        }


                        Result Def2Ds1 = new Result();
                        //Results key for internal forces on slab
                        ResultKey keySlab = new ResultKey
                        {
                            EntityType  = eDsElementType.eDsElementType_Slab,
                            EntityName  = SlabName,
                            CaseType    = eDsElementType.eDsElementType_LoadCase,
                            CaseId      = Lc1Id,
                            Dimension   = eDimension.eDim_2D,
                            ResultType  = eResultType.eFemDeformations,
                            CoordSystem = eCoordSystem.eCoordSys_Local
                        };


                        Def2Ds1 = rapi.LoadResult(keySlab);
                        if (Def2Ds1 != null)
                        {
                            Console.WriteLine(Def2Ds1.GetTextOutput());

                            double maxvalue = 0;
                            double pivot;
                            for (int i = 0; i < Def2Ds1.GetMeshElementCount(); i++)
                            {
                                pivot = Def2Ds1.GetValue(2, i);
                                if (System.Math.Abs(pivot) > System.Math.Abs(maxvalue))
                                {
                                    maxvalue = pivot;
                                }
                                ;
                            }
                            ;
                            Console.WriteLine("Maximum deformation on slab:");
                            Console.WriteLine(maxvalue);
                        }
                    }
                    else
                    {
                        throw new Exception("No results accessible");
                    }

                    Console.WriteLine($"Press key to exit");
                    Console.ReadKey();
                }
                #endregion
                proj.CloseProject(SCIA.OpenAPI.SaveMode.SaveChangesNo);
                env.Dispose();
            }
        }