fix: ensure absolute coordinates and .lib extension in post output
Convert programs to absolute mode before extracting features for Cincinnati post output, fixing incorrect coordinates when programs are stored in incremental mode. Also ensure G89 library names always end with .lib extension. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,7 @@ public sealed class CincinnatiPartSubprogramWriter
|
||||
mapping[key] = subNum;
|
||||
|
||||
var pgm = part.Program.Clone() as Program;
|
||||
pgm.Mode = Mode.Absolute;
|
||||
var bbox = pgm.BoundingBox();
|
||||
pgm.Offset(-bbox.Location.X, -bbox.Location.Y);
|
||||
|
||||
|
||||
@@ -69,8 +69,11 @@ public static class FeatureUtils
|
||||
/// Splits a part's program into features by rapids, classifies each as etch or cut,
|
||||
/// and orders etch features before cut features.
|
||||
/// </summary>
|
||||
public static List<(List<ICode> codes, bool isEtch)> SplitAndClassify(Part part) =>
|
||||
ClassifyAndOrder(SplitByRapids(part.Program.Codes));
|
||||
public static List<(List<ICode> codes, bool isEtch)> SplitAndClassify(Part part)
|
||||
{
|
||||
part.Program.Mode = Mode.Absolute;
|
||||
return ClassifyAndOrder(SplitByRapids(part.Program.Codes));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any non-rapid move in the feature has LayerType.Scribe.
|
||||
|
||||
@@ -24,7 +24,7 @@ public sealed class MaterialLibraryResolver
|
||||
System.Math.Abs(e.Thickness - thickness) <= ThicknessTolerance &&
|
||||
string.Equals(e.Gas, gas, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return entry?.Library ?? "";
|
||||
return EnsureLibExtension(entry?.Library ?? "");
|
||||
}
|
||||
|
||||
public string ResolveEtchLibrary(string gas)
|
||||
@@ -32,7 +32,18 @@ public sealed class MaterialLibraryResolver
|
||||
var entry = _etchLibraries.FirstOrDefault(e =>
|
||||
string.Equals(e.Gas, gas, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return entry?.Library ?? "";
|
||||
return EnsureLibExtension(entry?.Library ?? "");
|
||||
}
|
||||
|
||||
private static string EnsureLibExtension(string library)
|
||||
{
|
||||
if (string.IsNullOrEmpty(library))
|
||||
return library;
|
||||
|
||||
if (!library.EndsWith(".lib", StringComparison.OrdinalIgnoreCase))
|
||||
return library + ".lib";
|
||||
|
||||
return library;
|
||||
}
|
||||
|
||||
public static string ResolveGas(Nest nest, CincinnatiPostConfig config)
|
||||
|
||||
Reference in New Issue
Block a user