fix: repair double-encoded degree symbol in DXF output
ACadSharp misreads UTF-8 degree symbol (C2 B0) as two ANSI_1252 characters (°) then writes that back out. Post-process the saved DXF to replace ° with ° so bend notes display correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
Submodule EtchBendLines updated: 3c1700c480...da4d3228b0
@@ -307,6 +307,7 @@ namespace ExportDXF.Services
|
|||||||
{
|
{
|
||||||
var etcher = new EtchBendLines.Etcher();
|
var etcher = new EtchBendLines.Etcher();
|
||||||
etcher.AddEtchLines(dxfPath);
|
etcher.AddEtchLines(dxfPath);
|
||||||
|
FixDegreeSymbol(dxfPath);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -314,6 +315,20 @@ namespace ExportDXF.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ACadSharp misreads the UTF-8 degree symbol (C2 B0) as two ANSI_1252
|
||||||
|
/// characters (°). Fix it in the written DXF so bend notes display correctly.
|
||||||
|
/// </summary>
|
||||||
|
private static void FixDegreeSymbol(string path)
|
||||||
|
{
|
||||||
|
var text = System.IO.File.ReadAllText(path);
|
||||||
|
if (text.Contains("\u00C2\u00B0"))
|
||||||
|
{
|
||||||
|
text = text.Replace("\u00C2\u00B0", "\u00B0");
|
||||||
|
System.IO.File.WriteAllText(path, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string GetSinglePartFileName(ModelDoc2 model, string prefix)
|
private string GetSinglePartFileName(ModelDoc2 model, string prefix)
|
||||||
{
|
{
|
||||||
var title = model.GetTitle().Replace(".SLDPRT", "");
|
var title = model.GetTitle().Replace(".SLDPRT", "");
|
||||||
|
|||||||
Reference in New Issue
Block a user