Esempio n. 1
0
        public override void GenerateRunBat()
        {
            StringBuilder sbuilder = new StringBuilder();

            sbuilder.AppendLine("REM ****************************");
            sbuilder.AppendLine("REM Ballistic Tool");
            sbuilder.AppendLine("REM ****************************");

            sbuilder.AppendLine("set BALLISTIC_CONFIG_FILE=\"BallisticConfig.json\"");
            sbuilder.AppendLine("set BALLISTIC_EXE_FILE_NAME=ballistics.exe");
            sbuilder.AppendLine("set BALLISTIC_EXE=\"%SWRI_BALLISTIC_EXTENSIONS%\\%BALLISTIC_EXE_FILE_NAME%\"\n");

            sbuilder.AppendLine("if exist %BALLISTIC_EXE% goto  :BALLISTIC_EXE_FOUND");
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Could not find %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("echo		Your system is not properly configured to run %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Could not find ballistics.exe.\"\n");
            sbuilder.AppendLine("goto :ERROR_SECTION");

            sbuilder.AppendLine(":BALLISTIC_EXE_FOUND");
            sbuilder.AppendLine("%BALLISTIC_EXE% %BALLISTIC_CONFIG_FILE% --no-display\n");

            sbuilder.AppendLine("set ERROR_CODE=%ERRORLEVEL%");
            sbuilder.AppendLine("if %ERRORLEVEL% NEQ 0 (");
            sbuilder.AppendLine("set ERROR_MSG=\"ballistics.exe exited with error, exit code %ERROR_CODE%\"");
            sbuilder.AppendLine("goto :ERROR_SECTION");
            sbuilder.AppendLine(")");

            if (this.ballisticConfig.analysis.tier >= 3)
            {
                sbuilder.AppendLine("rd /s/q AP203_E2_SINGLE_FILE");
                sbuilder.AppendLine("del /f/q *.prt.* *.asm.*");
                sbuilder.AppendLine("rem ignore delete failures");
                sbuilder.AppendLine("cmd /c \"exit /b 0\"");
            }


            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation     = IsAutomated,
                XMLFileName    = "CADAssembly",
                Assembler      = "CREO",
                Mesher         = "NONE",
                Analyzer       = "NONE",
                CallDomainTool = sbuilder.ToString()
            };
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }


            // shotline viewer cmd file
            Template.run_shotlineviewer viewer = new Template.run_shotlineviewer();
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runShotlineViewer.bat")))
            {
                writer.WriteLine(viewer.TransformText());
            }
        }
Esempio n. 2
0
 public virtual void GenerateRunBat()
 {
     Template.run_bat searchmeta = new Template.run_bat()
     {
         Automation        = IsAutomated,
         XMLFileName       = "CADAssembly",
         AdditionalOptions = CADOptions ?? "",
         Assembler         = "CREO",
         Analyzer          = "NONE",
         Mesher            = "NONE"
     };
     using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
     {
         writer.WriteLine(searchmeta.TransformText());
     }
 }
Esempio n. 3
0
        public override void GenerateRunBat()
        {
            StringBuilder sbuilder = new StringBuilder();

            sbuilder.AppendLine();
            sbuilder.AppendLine("REM ****************************");
            sbuilder.AppendLine("REM Blast Tool");
            sbuilder.AppendLine("REM ****************************");
            sbuilder.AppendLine("set BLAST_CONFIG_FILE=\"BlastConfig.json\"");
            sbuilder.AppendLine("set BLAST_EXE_FILE_NAME=blast.exe");
            sbuilder.AppendLine("set BLAST_EXE=\"%SWRI_BALLISTIC_EXTENSIONS%\\%BLAST_EXE_FILE_NAME%\"\n");

            // FIXME if both %SWRI_BALLISTIC_EXTENSIONS% and %BLAST_EXE_FILE_NAME% are empty, BLAST_EXE==\ which always exists
            sbuilder.AppendLine("if exist %BLAST_EXE% goto  :BLAST_EXE_FOUND");
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Could not find %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("echo		Your system is not properly configured to run %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Could not find ballistics.exe.\"");
            sbuilder.AppendLine("goto :ERROR_SECTION\n");

            sbuilder.AppendLine(":BLAST_EXE_FOUND");
            sbuilder.AppendLine("%BLAST_EXE% %BLAST_CONFIG_FILE%\n");

            sbuilder.AppendLine("set ERROR_CODE=%ERRORLEVEL%");
            sbuilder.AppendLine("if %ERRORLEVEL% NEQ 0 (");
            sbuilder.AppendLine("set ERROR_MSG=\"blast.exe exited with error, exit code %ERROR_CODE%\"");
            sbuilder.AppendLine("goto :ERROR_SECTION");
            sbuilder.AppendLine(")");

            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation  = IsAutomated,
                XMLFileName = "CADAssembly",
                //   ComputedMetricsPath = "ComputedValues.xml",
                Assembler      = "CREO",
                Mesher         = "NONE",
                Analyzer       = "NONE",
                CallDomainTool = sbuilder.ToString()
            };
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }
        }
Esempio n. 4
0
        public override void GenerateRunBat()
        {
            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation        = IsAutomated,
                XMLFileName       = "CADAssembly",
                AdditionalOptions = CADOptions ?? "",
                Assembler         = "CREO",
                Analyzer          = "NONE",
                Mesher            = "NONE"
            };

            /*string domaintool = "";
             * foreach (var carcomp in CarComputations){
             *  string inputs="";
             *  foreach (KeyValuePair<string,string> i in carcomp.Parameters)
             *  {
             *      if (i.Key == "torque_curve")
             *      {
             *          using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "torque_curve.txt")))
             *          {
             *              writer.WriteLine(i.Value);
             *          }
             *      }
             *      else
             *      {
             *          inputs += i.Key + "=" + i.Value + ";";
             *      }
             *  }
             *  domaintool += "\"%MetaPath%\\bin\\Python27\\Scripts\\Python.exe\" \"%MetaPath%\\bin\\CAD\\CarCalculators.py\" -calc " + carcomp.Type.ToString().ToLower() + " -inputs " + inputs + " -metric " + carcomp.Metric + "\n";
             * }
             * searchmeta.CallDomainTool = domaintool;*/
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }
        }
Esempio n. 5
0
 public override void GenerateRunBat()
 {
     Template.run_bat searchmeta = new Template.run_bat()
     {
         Automation = IsAutomated,
         XMLFileName = "CADAssembly",
         AdditionalOptions = CADOptions ?? "",
         Assembler = "CREO",
         Analyzer = "NONE",
         Mesher = "NONE"
     };
     /*string domaintool = "";
     foreach (var carcomp in CarComputations){
         string inputs="";
         foreach (KeyValuePair<string,string> i in carcomp.Parameters)
         {
             if (i.Key == "torque_curve")
             {
                 using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "torque_curve.txt")))
                 {
                     writer.WriteLine(i.Value);
                 }
             }
             else
             {
                 inputs += i.Key + "=" + i.Value + ";";
             }
         }
         domaintool += "\"%MetaPath%\\bin\\Python27\\Scripts\\Python.exe\" \"%MetaPath%\\bin\\CAD\\CarCalculators.py\" -calc " + carcomp.Type.ToString().ToLower() + " -inputs " + inputs + " -metric " + carcomp.Metric + "\n";
     }
     searchmeta.CallDomainTool = domaintool;*/
     using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
     {
         writer.WriteLine(searchmeta.TransformText());
     }
 }
        public override void GenerateRunBat()
        {
            // Adams specific script
            StringBuilder sbuilder = new StringBuilder();
            string scriptparams = "";
            if (!String.IsNullOrEmpty(TerrainFileName))
            {
                scriptparams += "-terrain " + TerrainFileName + " -firstpass 1";
            }
            sbuilder.AppendLine("set ADAMS_SCRIPT=\"%MetaPath%bin\\CAD\\Adams\\CreateAdamsModel.py\"\n");

            sbuilder.AppendLine("if exist %ADAMS_SCRIPT% goto  :ADAMS_SCRIPT_FOUND");
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Could not find %ADAMS_SCRIPT%.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Could not find %ADAMS_SCRIPT%.\"");
            sbuilder.AppendLine("goto :ERROR_SECTION\n");

            sbuilder.AppendLine(":ADAMS_SCRIPT_FOUND");
            sbuilder.AppendLine("del adams.log\n");
            sbuilder.AppendLine("\"%MetaPath%bin\\Python27\\Scripts\\Python.exe\" %ADAMS_SCRIPT% " + scriptparams + " >> adams.log\n");

            if (!String.IsNullOrEmpty(TerrainFileName))
            {
                sbuilder.AppendLine("call %ADAMS_PATH%\\bin\\adams2013_2_x64.bat aview ru-st b adams_output.cmd\n");
                sbuilder.AppendLine("set PYTHONHOME=");
                scriptparams = "-terrain " + TerrainFileName;
                sbuilder.AppendLine("%MetaPath%bin\\Python27\\Scripts\\Python.exe\" %ADAMS_SCRIPT% " + scriptparams + " >> adams.log\n");
            }

            sbuilder.AppendLine("if %ERRORLEVEL% NEQ 0 (\n");
            sbuilder.AppendLine("set ERROR_CODE=%ERRORLEVEL%\n");
            sbuilder.AppendLine("set ERROR_MSG=\"Error during running the CreateAdamsModel script: error code is %ERROR_CODE%\"\n");
            sbuilder.AppendLine("echo %ERROR_MSG% >>_FAILED.txt\n");
            sbuilder.AppendLine("type adams.log >> _FAILED.txt\n");
            sbuilder.AppendLine("echo \"\"\n");
            sbuilder.AppendLine("echo \"See Error Log: _FAILED.txt\"\n");
            sbuilder.AppendLine("ping -n 8 127.0.0.1 > nul\n");
            sbuilder.AppendLine("exit /b %ERROR_CODE%\n");
            sbuilder.AppendLine(")\n");

            sbuilder.AppendLine("if exist %ADAMS_PATH%\\bin\\adams2013_2_x64.bat goto  :ADAMS_FOUND");
            
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Adams is not installed or ADAMS_PATH environment variable is not set.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Adams is not installed or ADAMS_PATH environment variable is not set.\"");
            sbuilder.AppendLine("goto :ERROR_SECTION\n");

            sbuilder.AppendLine(":ADAMS_FOUND");
            sbuilder.AppendLine("call %ADAMS_PATH%\\bin\\adams2013_2_x64.bat aview ru-st b adams_output.cmd");

            sbuilder.AppendLine("type aview.log | find /c \"ERROR:\" > tmpfile");
            sbuilder.AppendLine("FOR /F %%p IN ('type tmpfile') DO set crap=%%p");
            sbuilder.AppendLine("del tmpfile");

            sbuilder.AppendLine("if %crap% NEQ 0 (\n");
            sbuilder.AppendLine("set ERROR_CODE=2\n");
            sbuilder.AppendLine("set ERROR_MSG=\"Adams log contains errors.\n");
            sbuilder.AppendLine("echo %ERROR_MSG% >>_FAILED.txt\n");
            sbuilder.AppendLine("type aview.log >> _FAILED.txt\n");
            sbuilder.AppendLine("echo \"See Error Log: _FAILED.txt\"\n");
            sbuilder.AppendLine("ping -n 8 127.0.0.1 > nul\n");
            sbuilder.AppendLine("exit /b %ERROR_CODE%\n");
            sbuilder.AppendLine(")\n");


            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation = false,
                XMLFileName = "CADAssembly",
                ComputedMetricsPath = "\"Analysis\\Abaqus\\ComputedValues.xml\"",
                AdditionalOptions = CADOptions??"",
                Assembler = "CREO",
                Mesher = "NONE",
                Analyzer = "NONE",
                CallDomainTool = sbuilder.ToString()
            };
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }
        }
        public override void GenerateRunBat()
        {
            StringBuilder sbuilder = new StringBuilder();
            sbuilder.AppendLine("REM ****************************");
            sbuilder.AppendLine("REM Ballistic Tool");
            sbuilder.AppendLine("REM ****************************");

            sbuilder.AppendLine("set BALLISTIC_CONFIG_FILE=\"BallisticConfig.json\"");
            sbuilder.AppendLine("set BALLISTIC_EXE_FILE_NAME=ballistics.exe");
            sbuilder.AppendLine("set BALLISTIC_EXE=\"%SWRI_BALLISTIC_EXTENSIONS%\\%BALLISTIC_EXE_FILE_NAME%\"\n");

            sbuilder.AppendLine("if exist %BALLISTIC_EXE% goto  :BALLISTIC_EXE_FOUND");
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Could not find %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("echo		Your system is not properly configured to run %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Could not find ballistics.exe.\"\n");
            sbuilder.AppendLine("goto :ERROR_SECTION");

            sbuilder.AppendLine(":BALLISTIC_EXE_FOUND");
            sbuilder.AppendLine("%BALLISTIC_EXE% %BALLISTIC_CONFIG_FILE% --no-display\n");

            sbuilder.AppendLine("set ERROR_CODE=%ERRORLEVEL%");
            sbuilder.AppendLine("if %ERRORLEVEL% NEQ 0 (");
            sbuilder.AppendLine("set ERROR_MSG=\"ballistics.exe exited with error, exit code %ERROR_CODE%\"");
            sbuilder.AppendLine("goto :ERROR_SECTION");
            sbuilder.AppendLine(")");

            if (this.ballisticConfig.analysis.tier >= 3)
            {
                sbuilder.AppendLine("rd /s/q AP203_E2_SINGLE_FILE");
                sbuilder.AppendLine("del /f/q *.prt.* *.asm.*");
                sbuilder.AppendLine("rem ignore delete failures");
                sbuilder.AppendLine("cmd /c \"exit /b 0\"");
            }


            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation = IsAutomated,
                XMLFileName = "CADAssembly",
                Assembler = "CREO",
                Mesher = "NONE",
                Analyzer = "NONE",
                CallDomainTool = sbuilder.ToString()
            };
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }


            // shotline viewer cmd file
            Template.run_shotlineviewer viewer = new Template.run_shotlineviewer();
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runShotlineViewer.bat")))
            {
                writer.WriteLine(viewer.TransformText());
            }

        }
        public override void GenerateRunBat()
        {
            StringBuilder sbuilder = new StringBuilder();
            sbuilder.AppendLine();
            sbuilder.AppendLine("REM ****************************");
            sbuilder.AppendLine("REM Blast Tool");
            sbuilder.AppendLine("REM ****************************");
            sbuilder.AppendLine("set BLAST_CONFIG_FILE=\"BlastConfig.json\"");
            sbuilder.AppendLine("set BLAST_EXE_FILE_NAME=blast.exe");
            sbuilder.AppendLine("set BLAST_EXE=\"%SWRI_BALLISTIC_EXTENSIONS%\\%BLAST_EXE_FILE_NAME%\"\n");

            // FIXME if both %SWRI_BALLISTIC_EXTENSIONS% and %BLAST_EXE_FILE_NAME% are empty, BLAST_EXE==\ which always exists
            sbuilder.AppendLine("if exist %BLAST_EXE% goto  :BLAST_EXE_FOUND");
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Could not find %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("echo		Your system is not properly configured to run %BALLISTIC_EXE_FILE_NAME%.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Could not find ballistics.exe.\"");
            sbuilder.AppendLine("goto :ERROR_SECTION\n");

            sbuilder.AppendLine(":BLAST_EXE_FOUND");
            sbuilder.AppendLine("%BLAST_EXE% %BLAST_CONFIG_FILE%\n");

            sbuilder.AppendLine("set ERROR_CODE=%ERRORLEVEL%");
            sbuilder.AppendLine("if %ERRORLEVEL% NEQ 0 (");
            sbuilder.AppendLine("set ERROR_MSG=\"blast.exe exited with error, exit code %ERROR_CODE%\"");
            sbuilder.AppendLine("goto :ERROR_SECTION");
            sbuilder.AppendLine(")");

            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation = IsAutomated,
                XMLFileName = "CADAssembly",
             //   ComputedMetricsPath = "ComputedValues.xml",
                Assembler = "CREO",
                Mesher = "NONE",
                Analyzer = "NONE",
                CallDomainTool = sbuilder.ToString()
            };
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }
        }
Esempio n. 9
0
 public virtual void GenerateRunBat()
 {
     Template.run_bat searchmeta = new Template.run_bat()
     {
         Automation = IsAutomated,
         XMLFileName = "CADAssembly",
         AdditionalOptions = CADOptions??"",
         Assembler = "CREO",
         Analyzer = "NONE",
         Mesher = "NONE"
     };
     using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
     {
         writer.WriteLine(searchmeta.TransformText());
     }
 }
Esempio n. 10
0
        public override void GenerateRunBat()
        {
            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation = IsAutomated,
                XMLFileName = "CADAssembly",
                ComputedMetricsPath = "\"Analysis\\Abaqus\\ComputedValues.xml\"",
                AdditionalOptions = CADOptions ?? "",
            };

            searchmeta.Assembler = "CREO";
            if (SolverType == CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.ABAQUS_Model_Based.ToString())
            {
                searchmeta.Mesher = "ABAQUS";
                searchmeta.Analyzer = "ABAQUSMODEL";
            }
            else if (SolverType == CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.ABAQUS_Deck_Based.ToString())
            {
                searchmeta.Mesher = "CREO";
                searchmeta.Analyzer = "ABAQUSDECK";
            }
            else if (SolverType == CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.NASTRAN.ToString())
            {
                searchmeta.Mesher = "CREO";
                searchmeta.Analyzer = "NASTRAN";
            }
            else if (SolverType == CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.CALCULIX.ToString())
            {
                searchmeta.Mesher = "CREO";
                searchmeta.Analyzer = "CALCULIX";
            }

            if (SolverType == CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.ABAQUS_Model_Based.ToString())
            {
                switch (CyphyTestBenchRef.Attributes.FEAMode)
                {
                    case CyPhyClasses.CADTestBench.AttributesClass.FEAMode_enum.Meshing_Only:
                        searchmeta.Analyzer = "NONE";
                        break;
                    case CyPhyClasses.CADTestBench.AttributesClass.FEAMode_enum.Meshing_and_Boundary_Conditions:
                        searchmeta.Analyzer = "NONE";
                        searchmeta.Mesher = "ABAQUSMDLCHECK";
                        break;
                    case CyPhyClasses.CADTestBench.AttributesClass.FEAMode_enum.Modal:
                        searchmeta.Mode = "MODAL";
                        break;
                    case CyPhyClasses.CADTestBench.AttributesClass.FEAMode_enum.Dynamic__Explicit_:
                        searchmeta.Mode = "DYNEXPL";
                        break;
                    case CyPhyClasses.CADTestBench.AttributesClass.FEAMode_enum.Dynamic__Implicit_:
                        searchmeta.Mode = "DYNIMPL";
                        break;
                    case CyPhyClasses.CADTestBench.AttributesClass.FEAMode_enum.Static__Standard_:
                        searchmeta.Mode = "STATIC";
                        break;
                }
            }
            /*if (SolverType == CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.ABAQUS_Model_Based.ToString())
                sbuilder.AppendLine("set ERROR_MSG=\"Script Error: error level is %ERROR_CODE%, see log/CyPhy2AbaqusCmd.log for details.\"");
            else
                sbuilder.AppendLine("set ERROR_MSG=\"%FEA_SCRIPT% encountered error during execution, error level is %ERROR_CODE%\"");
            sbuilder.AppendLine("goto :ERROR_SECTION");
            sbuilder.AppendLine(")");*/
            
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }
            
        }     
Esempio n. 11
0
        /*
         * // This code is copy/pasted from TestBench. Since this class is not a subclass of TestBench,
         * // it can't be re-used. Can this code be re-used from there by moving it to TestBenchBase?
         * private void AddStaticAnalysis(CAD.AssemblyType assemblyRoot, List<TBComputation> computations)
         * {
         *  if (computations.Any())
         *  {
         *      CAD.AnalysesType cadanalysis = GetCADAnalysis(assemblyRoot);
         *
         *      CAD.StaticType staticanalysis = new CAD.StaticType();
         *      staticanalysis._id = UtilityHelpers.MakeUdmID();
         *      staticanalysis.AnalysisID = AnalysisID;
         *
         *      List<CAD.MetricType> metriclist = new List<CAD.MetricType>();
         *      foreach (var item in computations)
         *      {
         *          if (item.ComputationType == TBComputation.Type.POINTCOORDINATES)
         *          {
         *              CAD.MetricType ptout = new CAD.MetricType();
         *              ptout._id = UtilityHelpers.MakeUdmID();
         *              ptout.ComponentID = item.ComponentID;
         *              ptout.MetricID = item.MetricID;
         *              ptout.MetricType1 = item.ComputationType.ToString();
         *              ptout.RequestedValueType = item.RequestedValueType;
         *              ptout.Details = item.FeatureDatumName;
         *              ptout.ComponentID = String.IsNullOrEmpty(item.ComponentID) ? "" : item.ComponentID;     // PointCoordinate metric is tied to a specific Component
         *              ptout.MetricName = item.MetricName ?? "";
         *              metriclist.Add(ptout);
         *          }
         *          else
         *          {
         *              CAD.MetricType metric = new CAD.MetricType();
         *              metric._id = UtilityHelpers.MakeUdmID();
         *              metric.MetricID = item.MetricID;
         *              metric.MetricType1 = item.ComputationType.ToString();
         *              metric.RequestedValueType = item.RequestedValueType;
         *              metric.ComponentID = assemblyRoot.ConfigurationID;
         *              metric.Details = "";
         *              metric.MetricName = item.MetricName ?? "";
         *              metriclist.Add(metric);
         *          }
         *      }
         *
         *      staticanalysis.Metrics = new CAD.MetricsType();
         *      staticanalysis.Metrics._id = UtilityHelpers.MakeUdmID();
         *      staticanalysis.Metrics.Metric = metriclist.ToArray();
         *
         *      cadanalysis.Static = new CAD.StaticType[] { staticanalysis };
         *  }
         * }
         */

        public override void GenerateRunBat()
        {
            // Adams specific script
            StringBuilder sbuilder     = new StringBuilder();
            string        scriptparams = "";

            if (!String.IsNullOrEmpty(TerrainFileName))
            {
                scriptparams += "-terrain " + TerrainFileName + " -firstpass 1";
            }
            sbuilder.AppendLine("set ADAMS_SCRIPT=\"%MetaPath%bin\\CAD\\Adams\\CreateAdamsModel.py\"\n");

            sbuilder.AppendLine("if exist %ADAMS_SCRIPT% goto  :ADAMS_SCRIPT_FOUND");
            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Could not find %ADAMS_SCRIPT%.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Could not find %ADAMS_SCRIPT%.\"");
            sbuilder.AppendLine("goto :ERROR_SECTION\n");

            sbuilder.AppendLine(":ADAMS_SCRIPT_FOUND");
            sbuilder.AppendLine("del adams.log\n");
            sbuilder.AppendLine("\"%MetaPath%bin\\Python27\\Scripts\\Python.exe\" %ADAMS_SCRIPT% " + scriptparams + " >> adams.log\n");

            if (!String.IsNullOrEmpty(TerrainFileName))
            {
                sbuilder.AppendLine("call %ADAMS_PATH%\\bin\\adams2013_2_x64.bat aview ru-st b adams_output.cmd\n");
                sbuilder.AppendLine("set PYTHONHOME=");
                scriptparams = "-terrain " + TerrainFileName;
                sbuilder.AppendLine("%MetaPath%bin\\Python27\\Scripts\\Python.exe\" %ADAMS_SCRIPT% " + scriptparams + " >> adams.log\n");
            }

            sbuilder.AppendLine("if %ERRORLEVEL% NEQ 0 (\n");
            sbuilder.AppendLine("set ERROR_CODE=%ERRORLEVEL%\n");
            sbuilder.AppendLine("set ERROR_MSG=\"Error during running the CreateAdamsModel script: error code is %ERROR_CODE%\"\n");
            sbuilder.AppendLine("echo %ERROR_MSG% >>_FAILED.txt\n");
            sbuilder.AppendLine("type adams.log >> _FAILED.txt\n");
            sbuilder.AppendLine("echo \"\"\n");
            sbuilder.AppendLine("echo \"See Error Log: _FAILED.txt\"\n");
            sbuilder.AppendLine("exit /b %ERROR_CODE%\n");
            sbuilder.AppendLine(")\n");

            sbuilder.AppendLine("if exist %ADAMS_PATH%\\bin\\adams2013_2_x64.bat goto  :ADAMS_FOUND");

            sbuilder.AppendLine("@echo off");
            sbuilder.AppendLine("echo		Error: Adams is not installed or ADAMS_PATH environment variable is not set.");
            sbuilder.AppendLine("set ERROR_CODE=2");
            sbuilder.AppendLine("set ERROR_MSG=\"Error: Adams is not installed or ADAMS_PATH environment variable is not set.\"");
            sbuilder.AppendLine("goto :ERROR_SECTION\n");

            sbuilder.AppendLine(":ADAMS_FOUND");
            sbuilder.AppendLine("call %ADAMS_PATH%\\bin\\adams2013_2_x64.bat aview ru-st b adams_output.cmd");

            sbuilder.AppendLine("type aview.log | find /c \"ERROR:\" > tmpfile");
            sbuilder.AppendLine("FOR /F %%p IN ('type tmpfile') DO set crap=%%p");
            sbuilder.AppendLine("del tmpfile");

            sbuilder.AppendLine("if %crap% NEQ 0 (\n");
            sbuilder.AppendLine("set ERROR_CODE=2\n");
            sbuilder.AppendLine("set ERROR_MSG=\"Adams log contains errors.\n");
            sbuilder.AppendLine("echo %ERROR_MSG% >>_FAILED.txt\n");
            sbuilder.AppendLine("type aview.log >> _FAILED.txt\n");
            sbuilder.AppendLine("echo \"See Error Log: _FAILED.txt\"\n");
            sbuilder.AppendLine("exit /b %ERROR_CODE%\n");
            sbuilder.AppendLine(")\n");


            Template.run_bat searchmeta = new Template.run_bat()
            {
                Automation          = false,
                XMLFileName         = "CADAssembly",
                ComputedMetricsPath = "\"Analysis\\Abaqus\\ComputedValues.xml\"",
                AdditionalOptions   = CADOptions ?? "",
                Assembler           = "CREO",
                Mesher         = "NONE",
                Analyzer       = "NONE",
                CallDomainTool = sbuilder.ToString()
            };
            using (StreamWriter writer = new StreamWriter(Path.Combine(OutputDirectory, "runCADJob.bat")))
            {
                writer.WriteLine(searchmeta.TransformText());
            }
        }