namespace OpenNest { /// /// When automatic nesting and fills may place parts one kerf apart on a common line (see /// docs/common-line-cutting.md). Only drawings with take part. /// public enum CommonLineUsage { /// Never: engines and fills behave exactly as without common lines. Off, /// /// Only when it places more parts (or, in a whole job, uses fewer sheets) than the best /// layout without common lines; a tie keeps the layout without them. /// WhenItAddsParts, /// /// Whenever it shortens the cut or uses less material, never at the cost of a part: /// part count still ranks first. /// Whenever, } } namespace OpenNest { /// The names is saved under (nest files and defaults.json). public static class CommonLineUsageNames { /// The saved name, or null for (omitted). public static string Format(CommonLineUsage usage) => usage switch { CommonLineUsage.WhenItAddsParts => "whenItAddsParts", CommonLineUsage.Whenever => "whenever", _ => null, }; /// Reads a saved name case-insensitively; anything else is off. public static CommonLineUsage Parse(string name) => string.Equals(name, "whenItAddsParts", System.StringComparison.OrdinalIgnoreCase) ? CommonLineUsage.WhenItAddsParts : string.Equals(name, "whenever", System.StringComparison.OrdinalIgnoreCase) ? CommonLineUsage.Whenever : CommonLineUsage.Off; } }