public void Execute(IPCBIWindow parent) { IStep step = parent.GetCurrentStep(); if (step == null) { return; } string layernameTopHeightRestrictions = "drc_comp"; ICMPLayer topCMPLayer = step.GetCMPLayer(true); //for bottom change here to false ILayer HeightRestirctionLayer = step.GetLayer(layernameTopHeightRestrictions); // check each cmp for height restrictions foreach (ICMPObject cmp in topCMPLayer.GetAllLayerObjects()) { foreach (IODBObject surface in HeightRestirctionLayer.GetAllObjectInRectangle(cmp.Bounds)) { if (surface.IsPointOfSecondObjectIncluded(cmp, false)) //intersecting is ok? { //check height of cmp IAttributeElement attributeMaxHeight = null; foreach (IAttributeElement attribute in IAttribute.GetAllAttributes(surface)) { if (attribute.AttributeEnum == PCBI.FeatureAttributeEnum.drc_max_height) { attributeMaxHeight = attribute; break; } } if (attributeMaxHeight == null) { continue; } if (cmp.CompHEIGHT > (double)attributeMaxHeight.Value) //we know this attribute has double values { cmp.ObjectColorTemporary(Color.LightCoral); //change color to highlight cmps //surface.ObjectColorTemporary(Color.Wheat); surface.FreeText = "Check Height of " + cmp.Ref; break; } } } } topCMPLayer.EnableLayer(true); HeightRestirctionLayer.EnableLayer(true); parent.UpdateView(); }