public static Electrode GetElectrode(Snap.NX.Body body) { Electrode result = null; var elecName = body.Name; var faces = body.Faces; //顶面 var topFace = faces.FirstOrDefault(u => u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_BOT)); //基准面 var baseFace = faces.FirstOrDefault(u => u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_TOP)); //基准台侧面 var baseSideFaces = faces.Where(u => u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_SIDE2) || u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_SIDE3) || u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_SIDE5) || u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_SIDE6) ).ToList(); //象限面 var chamferFace = faces.FirstOrDefault(u => u.MatchAttrValue(UP_PART_MOLD_FACE_TYPE, BASE_CHAMFER)); if (!string.IsNullOrEmpty(elecName) && topFace != null && baseFace != null && baseSideFaces.Count >= 4) { var model = new UPElectrode(); model.BaseFace = baseFace; model.TopFace = topFace; model.BaseSideFaces = baseSideFaces.ToList(); model.ElecBody = body; model.ChamferFace = chamferFace; //model.ElecHeadFaces = Electrode.GetElecHeadFaces(faces.ToList(), baseFace, out baseSideFaces); result = model; model.AllObject.Add(body); } return(result); }
public static Electrode GetElectrode(Snap.NX.Body body) { Electrode result = null; result = XKElectrode.GetElectrode(body); if (result == null) { result = UPElectrode.GetElectrode(body); } if (result == null) { result = JYElectrode.GetElectrode(body); } if (result == null) { result = EactElectrode.GetElectrode(body); } return(result); }