Hi.Sample/MachineTool/DemoBuildEmptyMachineTool.cs
2025-04-08 19:35:28 +08:00

39 lines
1.5 KiB
C#

using Hi.Geom;
using Hi.Mech.Topo;
using Hi.NcMech.Xyzabc;
using Hi.Numerical.Xyzabc;
namespace Sample.MachineTool
{
/// <summary>
/// Demo generating empty machine tool instances for testing or development.
/// </summary>
public static class DemoBuildEmptyMachineTool
{
/// <summary>
/// Generates an empty machine tool with basic configuration.
/// </summary>
/// <returns>A configured but empty machine tool without solids.</returns>
public static CodeXyzabcMachineTool GenEmptyMachineTool()
{
CodeXyzabcChain chain = new CodeXyzabcChain("[O][C][w];[O][X][Y][Z][B][S][t]");
if (chain.ToolBuckleTransformer is StaticTranslation st)
st.Trans = new Vec3d(-200, 200, 400);
CodeXyzabcMachineTool xyzabcMachineTool = new CodeXyzabcMachineTool(chain);
return xyzabcMachineTool;
}
/// <summary>
/// Generates and saves an empty machine tool URI to a file.
/// </summary>
/// <param name="baseDirectory">The base directory to save the machine tool file.</param>
/// <returns>The machine tool URI object that was created and saved.</returns>
public static CodeXyzabcMachineToolUri GenEmptyMachineToolUri(string baseDirectory)
{
CodeXyzabcMachineToolUri machineToolUri = new CodeXyzabcMachineToolUri(@"Samples/EmpytMachineTool.mt",
GenEmptyMachineTool());
machineToolUri.SaveToUri(baseDirectory);
return machineToolUri;
}
}
}