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); } }
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); }
/// <summary> /// 读取属性 /// </summary> public void GetAttribute(Part obj) { this.EleName = AttributeUtils.GetAttrForString(obj, "EleName"); this.BorrowName = AttributeUtils.GetAttrForString(obj, "BorrowName"); this.PitchX = AttributeUtils.GetAttrForDouble(obj, "PitchX"); this.PitchXNum = AttributeUtils.GetAttrForInt(obj, "PitchXNum"); this.PitchY = AttributeUtils.GetAttrForDouble(obj, "PitchY"); this.PitchYNum = AttributeUtils.GetAttrForInt(obj, "PitchYNum"); this.CrudeInter = AttributeUtils.GetAttrForDouble(obj, "CrudeInter"); this.CrudeNum = AttributeUtils.GetAttrForInt(obj, "CrudeNum"); this.DuringInter = AttributeUtils.GetAttrForDouble(obj, "DuringInter"); this.DuringNum = AttributeUtils.GetAttrForInt(obj, "DuringNum"); this.FineInter = AttributeUtils.GetAttrForDouble(obj, "FineInter"); this.FineNum = AttributeUtils.GetAttrForInt(obj, "FineNum"); this.Material = AttributeUtils.GetAttrForString(obj, "Material1"); this.EleType = AttributeUtils.GetAttrForString(obj, "EleType"); this.Condition = AttributeUtils.GetAttrForString(obj, "Condition"); this.Extrudewith = AttributeUtils.GetAttrForDouble(obj, "Extrudewith"); this.Ch = AttributeUtils.GetAttrForString(obj, "CH"); this.IsPreparation = AttributeUtils.GetAttrForBool(obj, "IsPreparation"); this.Remarks = AttributeUtils.GetAttrForString(obj, "Remarks"); this.Technology = AttributeUtils.GetAttrForString(obj, "Technology"); this.CamTemplate = AttributeUtils.GetAttrForString(obj, "CamTemplate"); for (int i = 0; i < 3; i++) { this.EleSetValue[i] = AttributeUtils.GetAttrForDouble(obj, "EleSetValue", i); } for (int i = 0; i < 3; i++) { this.Preparation[i] = AttributeUtils.GetAttrForInt(obj, "Preparation", i); } this.Positioning = AttributeUtils.GetAttrForString(obj, "Positioning"); this.ElePresentation = AttributeUtils.GetAttrForString(obj, "ElePresentation"); this.Area = AttributeUtils.GetAttrForDouble(obj, "Area"); this.EleNumber = AttributeUtils.GetAttrForInt(obj, "EleNumber"); this.DatumWidth = AttributeUtils.GetAttrForDouble(obj, "DatumWidth"); this.EleMinDim = AttributeUtils.GetAttrForDouble(obj, "EleMinDim"); for (int i = 0; i < 2; i++) { this.EleHeadDis[i] = AttributeUtils.GetAttrForDouble(obj, "EleHeadDis", i); } }
/// <summary> /// 读取属性 /// </summary> public static ElectrodePreparationInfo GetAttribute(NXObject obj) { ElectrodePreparationInfo info = new ElectrodePreparationInfo(); try { info.IsPreparation = AttributeUtils.GetAttrForBool(obj, "IsPreparation"); info.Material = AttributeUtils.GetAttrForString(obj, "Material1"); for (int i = 0; i < 3; i++) { info.Preparation[i] = AttributeUtils.GetAttrForInt(obj, "Preparation", i); } return(info); } catch (NXException ex) { throw ex; } }
/// <summary> /// 以属性得到实体 /// </summary> /// <param name="obj"></param> /// <returns></returns> public new static WorkInfo GetAttribute(NXObject obj) { int num = 0; Matrix4 mat = new Matrix4(); mat.Identity(); try { num = AttributeUtils.GetAttrForInt(obj, "WorkNumber"); WorkInfo info = new WorkInfo(MoldInfo.GetAttribute(obj), UserModel.GetAttribute(obj), num, Matrix4Info.GetAttribute(obj).Matr); info.Interference = AttributeUtils.GetAttrForBool(obj, "Interference"); return(info); } catch (NXException ex) { ClassItem.WriteLogFile("未获取到属性" + ex.Message); return(new WorkInfo(MoldInfo.GetAttribute(obj), UserModel.GetAttribute(obj), num, mat)); } }
private bool PartIsAsm() { UserSingleton user = UserSingleton.Instance(); if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd()) { Part workPart = Session.GetSession().Parts.Work; if (!ASMModel.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); } else { return(false); } }
/// <summary> /// 获取是否扣间隙 /// </summary> /// <returns></returns> public bool GetIsInter() { return(AttributeUtils.GetAttrForBool(part, "Inter")); }