From ce89c7e38d6cec6555198288bbf299c87ef35576 Mon Sep 17 00:00:00 2001 From: CortexCore <2630229280@qq.com> Date: Sun, 3 Mar 2024 19:12:50 +0800 Subject: [PATCH] 1 --- Class1.cs | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/Class1.cs b/Class1.cs index 87bca9e..c4cb871 100644 --- a/Class1.cs +++ b/Class1.cs @@ -38,20 +38,33 @@ namespace BITFactory.Cutting.Mod stringBuilder.AppendLine($"导出时间: {DateTime.Now}"); foreach (var command in commands) { - switch (command) + if(command is CuttingPointCommand pointCommand) { - case CuttingPointCommand pointCommand: - stringBuilder.AppendLine( - $"切削点: {pointCommand.PlanePoint.x} {pointCommand.PlanePoint.y} {pointCommand.PlanePoint.z}"); - break; - case CuttingLineCommand lineCommand: - stringBuilder.AppendLine($"切削线:{lineCommand.Line.Length}"); - foreach (var linePos in lineCommand.Line) - { - stringBuilder.AppendLine($"切削线点: {linePos.x} {linePos.y} {linePos.z}"); - } - break; + stringBuilder.AppendLine( + $"切削点: {pointCommand.PlanePoint.x} {pointCommand.PlanePoint.y} {pointCommand.PlanePoint.z}"); } + else if(command is CuttingLineCommand lineCommand) + { + stringBuilder.AppendLine($"切削线:{lineCommand.Line.Length}"); + foreach (var linePos in lineCommand.Line) + { + stringBuilder.AppendLine($"切削线点: {linePos.x} {linePos.y} {linePos.z}"); + } + } + // switch (command) + // { + // case CuttingPointCommand pointCommand: + // stringBuilder.AppendLine( + // $"切削点: {pointCommand.PlanePoint.x} {pointCommand.PlanePoint.y} {pointCommand.PlanePoint.z}"); + // break; + // case CuttingLineCommand lineCommand: + // stringBuilder.AppendLine($"切削线:{lineCommand.Line.Length}"); + // foreach (var linePos in lineCommand.Line) + // { + // stringBuilder.AppendLine($"切削线点: {linePos.x} {linePos.y} {linePos.z}"); + // } + // break; + // } } File.WriteAllText(path, stringBuilder.ToString());