private static bool PartIsAsm(out List <ProgramModel> groups) { Session theSession = Session.GetSession(); NXOpen.UI theUI = NXOpen.UI.GetUI(); groups = new List <ProgramModel>(); if (!theSession.ApplicationName.Equals("UG_APP_MANUFACTURING", StringComparison.CurrentCultureIgnoreCase)) { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换到加工模块"); return(false); } group = GetNCGroup(); if (group == null) { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "没法找到AAA程序组"); return(false); } ProgramModel model = new ProgramModel(group); if (model.OperData.Count > 0) { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "程序组错误"); return(false); } foreach (NCGroup np in model.GetProgram()) { if (np.GetMembers().Length > 0) { ProgramModel nc = new ProgramModel(np); if (!nc.IsOperation() || !nc.Estimate) { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, np.Name + "错误"); return(false); } else { groups.Add(nc); } } } List <string> err = new List <string>(); foreach (ProgramModel pm in groups) { err.AddRange(pm.Gouged()); } if (err.Count > 0) { int ok = theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Question, "程序过切!"); if (ok == 2) { ClassItem.Print(err.ToArray()); return(false); } } return(true); }