private bool needtoAdd(List <MainPart> list, MainPart candidate, double percent) { bool result = true; foreach (var item in list) { int length = LongestCommonSubstringLength(candidate.Word, item.Word); if (length >= percent * candidate.Length) { result = false; break; } else { result = true; } } return(result); }
protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect) { bool whichX = quadrantString.Substring(0, 1) == "0" ? false : true; bool whichY = quadrantString.Substring(1, 1) == "0" ? false : true; bool whichZ = quadrantString.Substring(2, 1) == "0" ? false : true; Command.Execute("Select"); List <IDocObject> iDesBodies = new List <IDocObject>(); foreach (IDesignBody iDesBody in MainPart.GetDescendants <IDesignBody>()) { Point p = iDesBody.Master.Shape.GetBoundingBox(Matrix.Identity).Center; if ((p.X > 0 ^ whichX) && (p.Y > 0 ^ whichY) && (p.Z > 0 ^ whichZ)) { iDesBodies.Add(iDesBody); } } ActiveWindow.ActiveContext.Selection = iDesBodies; Command.Execute("IntersectTool"); }
private bool needtoAdd(List<MainPart> list, MainPart candidate, double percent) { bool result = true; foreach (var item in list) { int length = LongestCommonSubstringLength(candidate.Word, item.Word); if (length >= percent * candidate.Length) { result = false; break; } else result = true; } return result; }