public static void Main(string[] args) { IdeaInstallDir = IOM.SteelFrameDesktop.Properties.Settings.Default.IdeaInstallDir; if (!Directory.Exists(IdeaInstallDir)) { Console.WriteLine("IDEA StatiCa installation was not found in '{0}'", IdeaInstallDir); return; } Console.WriteLine("IDEA StatiCa installation directory is '{0}'", IdeaInstallDir); Console.WriteLine("Start generate example of IOM..."); // create IOM and results OpenModel example = SteelFrameExample.CreateIOM(); OpenModelResult result = Helpers.GetResults(); string iomFileName = "example.xml"; string iomResFileName = "example.xmlR"; // save to the files example.SaveToXmlFile(iomFileName); result.SaveToXmlFile(iomResFileName); var desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); var fileConnFileNameFromLocal = Path.Combine(desktopDir, "connectionFromIOM-local.ideaCon"); var calcFactory = new ConnHiddenClientFactory(IdeaInstallDir); var client = calcFactory.Create(); try { // it creates connection project from IOM Console.WriteLine("Creating Idea connection project "); client.CreateConProjFromIOM(iomFileName, iomResFileName, fileConnFileNameFromLocal); Console.WriteLine("Generated project was saved to the file '{0}'", fileConnFileNameFromLocal); } catch (Exception e) { Console.WriteLine("Error '{0}'", e.Message); } finally { if (client != null) { client.Close(); } } // end console application Console.WriteLine("Done. Press any key to exit."); Console.ReadKey(); }
public static void Main(string[] args) { IdeaInstallDir = IOM.SteelFrameDesktop.Properties.Settings.Default.IdeaInstallDir; if (!Directory.Exists(IdeaInstallDir)) { Console.WriteLine("IDEA StatiCa installation was not found in '{0}'", IdeaInstallDir); return; } Console.WriteLine("IDEA StatiCa installation directory is '{0}'", IdeaInstallDir); Console.WriteLine("Select the required example"); Console.WriteLine("1 - Steel frame ECEN"); Console.WriteLine("2 - Simple frame AUS"); var option = Console.ReadLine(); OpenModel iom = null; OpenModelResult iomResult = null; if (option.Equals("2", StringComparison.InvariantCultureIgnoreCase)) { Console.WriteLine("Generating Australian steel frame ..."); // create IOM and results iom = SimpleFrameAUS.CreateIOM(); iomResult = null; } else { Console.WriteLine("Generating ECEN steel frame ..."); // create IOM and results iom = SteelFrameExample.CreateIOM(); iomResult = Helpers.GetResults(); } string iomFileName = "example.xml"; string iomResFileName = "example.xmlR"; // save to the files iom.SaveToXmlFile(iomFileName); if (iomResult != null) { iomResult.SaveToXmlFile(iomResFileName); } else { iomResFileName = string.Empty; } var desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); var fileConnFileNameFromLocal = Path.Combine(desktopDir, "connectionFromIOM-local.ideaCon"); var calcFactory = new ConnHiddenClientFactory(IdeaInstallDir); var client = calcFactory.Create(); try { // it creates connection project from IOM Console.WriteLine("Creating Idea connection project "); client.CreateConProjFromIOM(iomFileName, iomResFileName, fileConnFileNameFromLocal); Console.WriteLine("Generated project was saved to the file '{0}'", fileConnFileNameFromLocal); } catch (Exception e) { Console.WriteLine("Error '{0}'", e.Message); } finally { if (client != null) { client.Close(); } } // end console application Console.WriteLine("Done. Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Start"); if (args.Length < 1) { Console.WriteLine("The path to Idea StatiCa installation dir is required as the argument"); return; } if (!Directory.Exists(args[0])) { Console.WriteLine(string.Format("Missing Idea StatiCa installation in '{0}'", args[0])); return; } string ideaStaticaInstallDir = args[0]; Console.WriteLine(string.Format("Using Idea StatiCa from '{0}'", ideaStaticaInstallDir)); // the default idea connection project for calculation string ideaConnProjectFileName = "testProj.ideaCon"; if (args.Length > 1) { // custom idea connection project can be specified in the second argumet ideaConnProjectFileName = args[1]; if (!File.Exists(ideaConnProjectFileName)) { Console.WriteLine(string.Format("The project file '{0}' doesn't exist", ideaConnProjectFileName)); return; } } // create the instance of factory - it looks for IDEA StatiCa in the directory 'ideaStaticaInstallDir' ConnHiddenClientFactory calcFactory = new ConnHiddenClientFactory(ideaStaticaInstallDir); //create the instance of the IDEA StatiCa Client ConnectionHiddenCheckClient client = calcFactory.Create(); try { // open project on the service side client.OpenProject(ideaConnProjectFileName); try { // get detail about idea connection project var projInfo = client.GetProjectInfo(); if (projInfo != null && projInfo.Connections != null) { // iterate all connections in the project foreach (var con in projInfo.Connections) { Console.WriteLine(string.Format("Starting calculation of connection {0}", con.Identifier)); // calculate a get results for each connection in the project var cbfemResults = client.Calculate(con.Identifier); Console.WriteLine("Calculation is done"); var jsonSetting = new Newtonsoft.Json.JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(), Culture = CultureInfo.InvariantCulture }; var jsonFormating = Newtonsoft.Json.Formatting.Indented; string resultsJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(cbfemResults, jsonFormating, jsonSetting); Console.WriteLine(resultsJsonString); // get the geometry of the connection in XML format var geometryJsonString = client.GetConnectionModelXML(con.Identifier); // convert it ir the instance var conData = Tools.ConnectionDataFromXml(geometryJsonString); Debug.Assert(conData != null, "Worng format"); Console.WriteLine(""); Console.WriteLine("The geometry of the calculated project"); Console.WriteLine(geometryJsonString); } } } finally { // Delete temps in case of a crash client.CloseProject(); } } finally { if (client != null) { client.Close(); } } Console.WriteLine("End"); }
static void Main(string[] args) { Console.WriteLine("Start"); if (args.Length < 1) { Console.WriteLine("The path to Idea StatiCa installation dir is required as the argument"); return; } if (!Directory.Exists(args[0])) { Console.WriteLine(string.Format("Missing Idea StatiCa installation in '{0}'", args[0])); return; } Console.WriteLine(string.Format("Using Idea StatiCa from '{0}'", args[0])); var calcFactory = new ConnHiddenClientFactory(args[0]); var client = calcFactory.Create(); try { client.OpenProject("testProj.ideaCon"); try { // get detail about idea connection project var projInfo = client.GetProjectInfo(); if (projInfo != null && projInfo.Connections != null) { // iterate all connections in the project foreach (var con in projInfo.Connections) { Console.WriteLine(string.Format("Starting calculation of connection {0}", con.Identifier)); // calculate a get results for each connection in the project var conRes = client.Calculate(con.Identifier); Console.WriteLine("Calculation is done"); // get the geometry of the connection var connectionModel = client.GetConnectionModel(con.Identifier); } } } finally { // Delete temps in case of a crash client.CloseProject(); } } finally { if (client != null) { client.Close(); } } Console.WriteLine("End"); var x = Console.ReadLine(); }