// PROJECT GHOST SLAB - MANUAL OVERRIDE
// Using the raw Entity list to find and kill the top copper.
const entities = Flux.getEntities();
let count = 0;
entities.forEach((ent: any) => {
// Look for the Top Layer polygon that is shorting the board
if (ent.type === "polygon" && ent.props?.layer === "Top") {
console.log("Found the culprit: " + (ent.name || ent.id));
// In some versions, the method is Flux.removeEntity()
// If deleteElement failed, we try remove.
try {
lux.removeEntity(ent.id);
count++;
} catch (e) {
console.log("Remove failed, trying alternative delete method...");
}
}