refactor(posts): remove CI Fiber part comment override
A fixed override wrote the same text on every part, making parts indistinguishable in the program. Each part's ( PART:... ) comment now always uses its source file or drawing name. Saved configs that still contain PartComment load normally; the key is ignored.
This commit is contained in:
@@ -329,4 +329,17 @@ public class CIFiberPostProcessorTests
|
|||||||
Assert.Equal("SSN", config.ResolveMaterialCode(" STAINLESS "));
|
Assert.Equal("SSN", config.ResolveMaterialCode(" STAINLESS "));
|
||||||
Assert.Equal("MSN", config.ResolveMaterialCode("Aluminum"));
|
Assert.Equal("MSN", config.ResolveMaterialCode("Aluminum"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SavedConfigWithRetiredPartComment_StillLoads()
|
||||||
|
{
|
||||||
|
const string json = """
|
||||||
|
{ "PartComment": "OLD", "MaxTableX": 120.0, "DefaultMaterialCode": "SSN" }
|
||||||
|
""";
|
||||||
|
|
||||||
|
var config = System.Text.Json.JsonSerializer.Deserialize<CIFiberPostConfig>(json)!;
|
||||||
|
|
||||||
|
Assert.Equal(120.0, config.MaxTableX);
|
||||||
|
Assert.Equal("SSN", config.DefaultMaterialCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,12 +91,6 @@ namespace OpenNest.Posts.CincinnatiCIFiber
|
|||||||
[PostSetting(MachineSection, 2, Minimum = 0, Maximum = 10000, DecimalPlaces = 3)]
|
[PostSetting(MachineSection, 2, Minimum = 0, Maximum = 10000, DecimalPlaces = 3)]
|
||||||
public double MaxTableY { get; set; } = 81.25;
|
public double MaxTableY { get; set; } = 81.25;
|
||||||
|
|
||||||
/// <summary>Comment text after the "( PART:" prefix for each part.</summary>
|
|
||||||
[DisplayName("Part comment")]
|
|
||||||
[Description("Text after \"( PART:\" for each part. Blank uses the source file or drawing name.")]
|
|
||||||
[PostSetting(OutputSection, 5)]
|
|
||||||
public string PartComment { get; set; } = "";
|
|
||||||
|
|
||||||
/// <summary>Skippable global subroutine used to cancel comp / park between features.</summary>
|
/// <summary>Skippable global subroutine used to cancel comp / park between features.</summary>
|
||||||
[DisplayName("Layer: cancel (L0)")]
|
[DisplayName("Layer: cancel (L0)")]
|
||||||
[Description("Called before each contour and at the end to cancel compensation and park.")]
|
[Description("Called before each contour and at the end to cancel compensation and park.")]
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ namespace OpenNest.Posts.CincinnatiCIFiber
|
|||||||
{
|
{
|
||||||
CIFiberFormatter.Line(w, $"( Part #{partNumber} )");
|
CIFiberFormatter.Line(w, $"( Part #{partNumber} )");
|
||||||
|
|
||||||
var partComment = ResolvePartComment(part);
|
var partComment = PartName(part);
|
||||||
CIFiberFormatter.Line(w, $"( PART:{partComment} )");
|
CIFiberFormatter.Line(w, $"( PART:{partComment} )");
|
||||||
|
|
||||||
CIFiberFormatter.Line(w, $"V.E.R4={partNumber}");
|
CIFiberFormatter.Line(w, $"V.E.R4={partNumber}");
|
||||||
@@ -269,11 +269,9 @@ namespace OpenNest.Posts.CincinnatiCIFiber
|
|||||||
CIFiberFormatter.Line(w, SkippableLine(_config.LayerCutEnd));
|
CIFiberFormatter.Line(w, SkippableLine(_config.LayerCutEnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ResolvePartComment(Part part)
|
/// <summary>Source file name without extension, else the drawing name.</summary>
|
||||||
|
private static string PartName(Part part)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(_config.PartComment))
|
|
||||||
return _config.PartComment;
|
|
||||||
|
|
||||||
var name = part.BaseDrawing?.Name ?? "";
|
var name = part.BaseDrawing?.Name ?? "";
|
||||||
var source = part.BaseDrawing?.Source?.Path;
|
var source = part.BaseDrawing?.Source?.Path;
|
||||||
if (!string.IsNullOrEmpty(source))
|
if (!string.IsNullOrEmpty(source))
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
"SkipScribe": true,
|
"SkipScribe": true,
|
||||||
"MaxTableX": 160.25,
|
"MaxTableX": 160.25,
|
||||||
"MaxTableY": 81.25,
|
"MaxTableY": 81.25,
|
||||||
"PartComment": "",
|
|
||||||
"LayerCancel": "L0",
|
"LayerCancel": "L0",
|
||||||
"LayerInteriorLeadin": "L2",
|
"LayerInteriorLeadin": "L2",
|
||||||
"LayerExteriorLeadin": "L4",
|
"LayerExteriorLeadin": "L4",
|
||||||
|
|||||||
Reference in New Issue
Block a user