public void Execute(IPCBIWindow Parent) { IStep step = Parent.GetCurrentStep(); IMatrix matrix = Parent.GetMatrix(); if (step == null) { return; } IODBObject profile = step.GetPCBOutlineAsODBObject(); foreach (string layerName in step.GetAllLayerNames()) { if (matrix.GetMatrixLayerType(layerName) == MatrixLayerType.Component) { continue; //no component layer } ILayer Layer = step.GetLayer(layerName); if (Layer is IODBLayer) { bool foundOne = false; IODBLayer layer = (IODBLayer)Layer; foreach (IODBObject obj in layer.GetAllLayerObjects()) { if (profile.IsPointOfSecondObjectIncluded(obj)) { //inside not relevant } else { obj.Select(true); foundOne = true; } } if (foundOne) { Layer.EnableLayer(true); } } } Parent.UpdateSelection(); Parent.UpdateView(); }
public void Execute(IPCBIWindow Parent) { IStep step = Parent.GetCurrentStep(); IMatrix matrix = Parent.GetMatrix(); if (step == null) { return; } IODBObject profile = step.GetPCBOutlineAsODBObject(); foreach (string layerName in step.GetAllLayerNames()) { if (matrix.GetMatrixLayerType(layerName) == MatrixLayerType.Component) { continue; //no component layers } ILayer Layer = step.GetLayer(layerName); if (Layer is IODBLayer) { List <IODBObject> objectsToDelete = new List <IODBObject>(); IODBLayer layer = (IODBLayer)Layer; foreach (IODBObject obj in layer.GetAllLayerObjects()) { if (profile.IsPointOfSecondObjectIncluded(obj)) { //inside not delete } else { objectsToDelete.Add(obj); } } layer.RemoveObjects(objectsToDelete); } } Parent.UpdateView(); }