feat(io): add TitleBlockDetector with layer name heuristic (phase 1)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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<string> TitleBlockLayerNames = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"TITLE", "TITLEBLOCK", "TITLE_BLOCK", "BORDER", "FRAME",
|
||||
"TB", "INFO", "SHEET", "ANNOTATION"
|
||||
};
|
||||
|
||||
public static HashSet<Guid> Detect(List<Entity> entities, CadDocument document)
|
||||
{
|
||||
var flagged = new HashSet<Guid>();
|
||||
DetectByLayerName(entities, flagged);
|
||||
return flagged;
|
||||
}
|
||||
|
||||
private static void DetectByLayerName(List<Entity> entities, HashSet<Guid> flagged)
|
||||
{
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (entity.Layer?.Name != null && TitleBlockLayerNames.Contains(entity.Layer.Name))
|
||||
flagged.Add(entity.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user