/// <summary> ///检查体 /// </summary> /// <returns></returns> public BodyInfo GetBodyInfoForInterference(bool extract, out List <string> err) { err = new List <string>(); List <Face> dischargeFace = new List <Face>(); List <Face> temp = new List <Face>(); List <Body> bodys = new List <Body>(); try { AnalysisUtils.SetInterferenceOutFace(this.eleBody, this.toolBody, out temp, out bodys); } catch (NXException ex) { err.Add("干涉检查错误!" + ex.Message); } if (bodys.Count > 0) { LayerUtils.MoveDisplayableObject(252, bodys.ToArray()); if (extract) { this.eleBody.Color = 186; } err.Add("电极头有过切,请检查!"); } dischargeFace = temp.Where(a => a.GetBody().Equals((this.eleBody))).Distinct().ToList(); //过滤电极面 List <Face> tt = temp.Where(a => a.GetBody().Equals((this.toolBody))).Distinct().ToList(); List <Face> faces = new List <Face>(); foreach (Face fe in dischargeFace) { FaceData data1 = FaceUtils.AskFaceData(fe); foreach (Face fa in tt) { FaceData fd = FaceUtils.AskFaceData(fa); if (UMathUtils.SelfDis(data1.Dir) == 0) { if (data1.FaceType == fd.FaceType && data1.IntNorm == -fd.IntNorm) { faces.Add(fe); break; } } else { double anlge = UMathUtils.Angle(data1.Dir, fd.Dir); if (data1.FaceType == fd.FaceType && data1.IntNorm == -fd.IntNorm && UMathUtils.IsEqual(anlge, Math.PI)) { faces.Add(fe); break; } } } } if (extract) { ExtractFace(this.toolBody, faces.ToArray()); } BodyInfo info = new BodyInfo(eleBody, faces); info.SetAttribute(csys, matr); return(info); }