using System; using System.Collections.Generic; using System.Linq; using ACadSharp; using OpenNest.Geometry; namespace OpenNest.IO { public static class TitleBlockDetector { private static readonly HashSet TitleBlockLayerNames = new(StringComparer.OrdinalIgnoreCase) { "TITLE", "TITLEBLOCK", "TITLE_BLOCK", "BORDER", "FRAME", "TB", "INFO", "SHEET", "ANNOTATION" }; public static HashSet Detect(List entities, CadDocument document) { var flagged = new HashSet(); DetectByLayerName(entities, flagged); return flagged; } private static void DetectByLayerName(List entities, HashSet flagged) { foreach (var entity in entities) { if (entity.Layer?.Name != null && TitleBlockLayerNames.Contains(entity.Layer.Name)) flagged.Add(entity.Id); } } } }