/// <summary> /// Create fdscript to run analysis. /// </summary> public static FdScript Analysis(string struxmlPath, Analysis analysis, List <string> bscPath, string docxTemplatePath, bool endSession) { CmdUserModule mode = CmdUserModule.RESMODE; FdScript fdScript = FdScript.CalculateStruxml(struxmlPath, mode, bscPath, docxTemplatePath, endSession); fdScript.CmdCalculation = new CmdCalculation(analysis); return(fdScript); }
/// <summary> /// Create fdscript to perform a calculation. /// </summary> internal static FdScript CalculateStruxml(string struxmlPath, CmdUserModule mode, List <string> bscPath, string docxTemplatePath, bool endSession) { FdScript fdScript = new FdScript(); fdScript.XmlAttrib = "fdscript.xsd"; fdScript.StruxmlPath = struxmlPath; fdScript.FileName = Path.GetFileNameWithoutExtension(struxmlPath); fdScript.Cwd = Path.GetDirectoryName(fdScript.StruxmlPath); fdScript.FdScriptPath = Path.Combine(fdScript.Cwd, fdScript.FileName, "scripts", "Analysis.fdscript"); // set header and logfile fdScript.FdScriptHeader = new FdScriptHeader("Generated script.", Path.Combine(fdScript.Cwd, fdScript.FileName, "logfile.log")); // set open fdScript.CmdOpen = new CmdOpen(fdScript.StruxmlPath); // set user fdScript.CmdUser = new CmdUser(mode); // listgen if (bscPath != null && bscPath.Any()) { fdScript.CmdListGen = new List <CmdListGen>(); foreach (string item in bscPath) { fdScript.CmdListGen.Add(new CmdListGen(item, Path.Combine(fdScript.Cwd, fdScript.FileName, "results"))); } } // set save docx if (docxTemplatePath != "" && docxTemplatePath != null) { // path to .dsc-file (template file) fdScript.DocxTemplatePath = docxTemplatePath; // object containing command to generate .docx and path to generated .docx fdScript.CmdSaveDocx = new CmdSaveDocx(fdScript.FileName + ".docx"); } // set save fdScript.CmdSave = new CmdSave(fdScript.Cwd + @"\" + fdScript.FileName + ".str"); // set endsession if (endSession) { fdScript.CmdEndSession = new CmdEndSession(); } // return return(fdScript); }
/// <summary> /// Create fdscript to run analysis and design. /// </summary> public static FdScript Design(string mode, string struxmlPath, Analysis analysis, Design design, List <string> bscPath, string docxTemplatePath, bool endSession) { CmdUserModule _mode = CmdUserModule.RCDESIGN; switch (mode) { case "rc": case "Rc": case "RC": case "RCDESIGN": _mode = CmdUserModule.RCDESIGN; break; case "steel": case "Steel": case "STEEL": case "STEELDESIGN": _mode = CmdUserModule.STEELDESIGN; break; case "timber": case "Timber": case "TIMBER": case "TIMBERDESIGN": _mode = CmdUserModule.TIMBERDESIGN; break; default: throw new ArgumentException("Mode is not supported. Mode should be rc, steel or timber"); } FdScript fdScript = FdScript.CalculateStruxml(struxmlPath, _mode, bscPath, docxTemplatePath, endSession); fdScript.CmdCalculation = new CmdCalculation(analysis, design); return(fdScript); }
public CmdUser(CmdUserModule module) { this.Command = module; }