62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
using CaeGlobals;
|
|
using CaeMesh;
|
|
using CaeMesh.Meshing;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace GmshCaller
|
|
{
|
|
internal class Program
|
|
{
|
|
private static int Main(string[] args)
|
|
{
|
|
string error = null;
|
|
if (args.Length == 2)
|
|
{
|
|
var gmshDataFileName = args[0];
|
|
if (File.Exists(gmshDataFileName))
|
|
{
|
|
try
|
|
{
|
|
var gmshData = Tools.LoadDumpFromFile<GmshData>(gmshDataFileName);
|
|
|
|
var gmshAPI = new GmshAPI(gmshData, Console.WriteLine);
|
|
|
|
if (Enum.TryParse(args[1], out GmshCommandEnum command))
|
|
{
|
|
switch (command)
|
|
{
|
|
case GmshCommandEnum.Mesh:
|
|
error = gmshAPI.CreateMesh();
|
|
break;
|
|
case GmshCommandEnum.Defeature:
|
|
error = gmshAPI.Defeature();
|
|
break;
|
|
default:
|
|
error = "The Gmsh command " + args[1] + " is not supported.";
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
error = "The Gmsh command " + args[1] + " is not supported.";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
error = "出现异常:" + ex.Message;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
error = "A Gmsh data file name and a Gmsh command parameters must be specified as arguments.";
|
|
}
|
|
|
|
Console.Error.WriteLine(error);
|
|
|
|
return error != null ? 1 : 0;
|
|
}
|
|
}
|
|
}
|