private bool PartIsAsm() { Part workPart = Session.GetSession().Parts.Work; if (!ParentAssmblieInfo.IsAsm(workPart)) { asm = ASMCollection.GetAsmModel(workPart); if (asm == null) { ClassItem.MessageBox("无法通过工作部件找到ASM!", NXMessageBox.DialogType.Error); return(false); } PartUtils.SetPartDisplay(asm.PartTag); } asm = new ASMModel(workPart); asmColl = new ASMCollection(asm); foreach (WorkModel wk in asmColl.GetWorks()) { bool isInter = AttributeUtils.GetAttrForBool(wk.PartTag, "Interference"); if (!isInter) { NXOpen.UI.GetUI().NXMessageBox.Show("提示", NXMessageBox.DialogType.Error, wk.AssembleName + "没有检查电极"); return(false); } } return(true); }
//------------------------------------------------------------------------------ //This method shows the dialog on the screen //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogResponse Show() { try { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { Part workPart = theSession.Parts.Work; if (!ParentAssmblieInfo.IsAsm(workPart)) { ASMModel asm = ASMCollection.GetAsmModel(workPart); if (asm != null) { PartUtils.SetPartDisplay(asm.PartTag); } else { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "工作部件无法找到ASM档!"); return(0); } } theDialog.Show(); } } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }