/// <summary> /// 获取工件名字 /// </summary> /// <param name="work"></param> /// <returns></returns> private List <string> GetWorkpieceName(WorkModel work) { List <Part> otherWorkpeces = work.GetAllWorkpiece(); List <string> name = new List <string>(); foreach (Part pt in otherWorkpeces) { name.Add(pt.Name); } name.Sort(); return(name); }
/// <summary> /// 干涉检查 /// </summary> /// <param name="eleCtBody"></param> /// <param name="eleName"></param> /// <param name="post"></param> /// <param name="picth"></param> /// <param name="err"></param> private void Interference(Component eleCt, string eleName, string post, string picth, ref List <string> err) { Body eleCtBody = GetOccsInBods(eleCt); foreach (Part pt in work.GetAllWorkpiece()) { Component ptCoo = GetPartInOcc(pt); if (ptCoo != null && !ptCoo.IsSuppressed) { Body by = GetOccsInBods(ptCoo); List <Body> bodys = new List <Body>(); if (by != null) { try { NXOpen.GeometricAnalysis.SimpleInterference.Result re = AnalysisUtils.SetInterferenceOutResult(eleCtBody, by, out bodys); if (re == NXOpen.GeometricAnalysis.SimpleInterference.Result.NoInterference) { err.Add(eleName + " " + pt.Name + picth + "没有干涉!"); } if (re == NXOpen.GeometricAnalysis.SimpleInterference.Result.InterferenceExists) { err.Add(eleName + " " + pt.Name + picth + "有干涉!"); } if (bodys.Count > 0) { foreach (Body body in bodys) { body.Layer = 252; } } } catch { ClassItem.WriteLogFile("干涉检查错误!"); } } else { err.Add(pt.Name + " 无法找到工件体,请检查引用集!"); } } } }
/// <summary> /// 获取件号名 /// </summary> /// <param name="name"></param> /// <param name="work"></param> /// <returns></returns> private string GetWorkpieceNumber(string name, WorkModel work) { foreach (Part pt in work.GetAllWorkpiece()) { if (pt.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)) { if (WorkpieceModel.IsWorkpiece(pt)) { WorkpieceModel wk = new WorkpieceModel(pt); return(wk.Info.MoldInfo.WorkpieceNumber); } else { return(pt.Name); } } } return(null); }