private bool PartIsAsm() { Part workPart = Session.GetSession().Parts.Work; MoldInfoModel mold = new MoldInfoModel(workPart); string type = AttributeUtils.GetAttrForString(workPart, "PartType"); if (type.Equals("ASM")) { assemble = AssembleSingleton.Instance().GetAssemble(mold.MoldNumber + "-" + mold.WorkpieceNumber); foreach (WorkModel work in assemble.Works) { if (!AttributeUtils.GetAttrForBool(work.PartTag, "Interference")) { UI.GetUI().NXMessageBox.Show("提示", NXMessageBox.DialogType.Error, "WORK" + work.WorkNumber.ToString() + "没有检查电极"); return(false); } } if (assemble.IsAssmbleOk()) { return(true); } else { return(false); } } else { UI.GetUI().NXMessageBox.Show("提示", NXMessageBox.DialogType.Error, "请切换到ASM下"); return(false); } }
//------------------------------------------------------------------------------ //This method shows the dialog on the screen //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogResponse Show() { try { string partType = AttributeUtils.GetAttrForString(workPart, "PartType"); if (!partType.Equals("Work")) { theUI.NXMessageBox.Show("错误!", NXMessageBox.DialogType.Error, "请切换到Work档下!"); return(0); } work.GetModelForPart(workPart); string asm = work.MoldInfo.MoldNumber + "-" + work.MoldInfo.WorkpieceNumber + "-ASM"; string name = work.MoldInfo.MoldNumber + "-" + work.MoldInfo.WorkpieceNumber; foreach (Part part in theSession.Parts) { if (part.Name.Equals(asm)) { assemble = AssembleSingleton.Instance().GetAssemble(name); } } if (assemble == null) { 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); }
public EleStandardSeatCreateForm(string vec) { theUFSession = UFSession.GetUFSession(); workPart = Session.GetSession().Parts.Work; MoldInfoModel moldInfo = new MoldInfoModel(workPart); string name = moldInfo.MoldNumber + "-" + moldInfo.WorkpieceNumber; model = new CreateConditionModel(); model.Assemble = AssembleSingleton.Instance().GetAssemble(name); model.VecName = vec.ToUpper(); }
//------------------------------------------------------------------------------ //This method shows the dialog on the screen //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogResponse Show() { try { Part workPart = theSession.Parts.Work; string type = AttributeUtils.GetAttrForString(workPart, "PartType"); if (type != "ASM") { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换ASM档为工作部件!"); return(0); } MoldInfoModel mold = new MoldInfoModel(workPart); assemble = AssembleSingleton.Instance().GetAssemble(mold.MoldNumber + "-" + mold.WorkpieceNumber); theDialog.Show(); if (err.Count != 0) { bool anyPartsModified; PartSaveStatus saveStatus; Part part = null; if ((part = ReplacePart.Replace(assemble.Asm, moldInfo)) != null) { moldInfo.SetAttribute(part); theSession.Parts.SaveAll(out anyPartsModified, out saveStatus); err.Add("修改" + assemble.Asm.AssembleName + "成功!"); } foreach (string st in err) { ClassItem.Print(st); } } } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }
//------------------------------------------------------------------------------ //This method shows the dialog on the screen //------------------------------------------------------------------------------ public NXOpen.UIStyler.DialogResponse Show() { try { Part workPart = theSession.Parts.Work; string type = AttributeUtils.GetAttrForString(workPart, "PartType"); if (!type.Equals("ASM", StringComparison.CurrentCultureIgnoreCase)) { theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换到ASM档"); return(0); } MoldInfoModel moldInfo = new MoldInfoModel(workPart); string name = moldInfo.MoldNumber + "-" + moldInfo.WorkpieceNumber; assemble = AssembleSingleton.Instance().GetAssemble(name); theDialog.Show(); } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }