Files
OpenNest/OpenNest.IO/CadFormats.cs
T
ajandClaude Opus 5.5 3a8994c8fe feat(io): import and export SVG drawings
Customers and design tools hand over SVGs, and getting them in meant a
trip through another CAD tool. CadImporter now reads them like any other
drawing, and plates, programs and converter entities can be written out.

An SVG's numbers are not drawing units, so import converts to the nest's
units and never guesses: only an absolute width or height counts as a
stated size, since px means 1/96 in to browsers but 1/72 in to
Illustrator. Without one the desktop asks, showing the size each choice
gives, and headless callers must pass the scale or the import fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:50:41 -04:00

22 lines
750 B
C#

using System;
using System.IO;
namespace OpenNest.IO
{
/// <summary>The drawing file types <see cref="CadImporter"/> reads.</summary>
public static class CadFormats
{
public const string OpenFileFilter =
"CAD Files (*.dxf;*.dwg;*.svg)|*.dxf;*.dwg;*.svg|"
+ "DXF Files (*.dxf)|*.dxf|DWG Files (*.dwg)|*.dwg|SVG Files (*.svg)|*.svg";
public static bool IsCadFile(string path)
{
var extension = Path.GetExtension(path);
return extension.Equals(".dxf", StringComparison.OrdinalIgnoreCase)
|| extension.Equals(".dwg", StringComparison.OrdinalIgnoreCase)
|| extension.Equals(".svg", StringComparison.OrdinalIgnoreCase);
}
}
}