Exemple #1
0
        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);
        }
Exemple #2
0
        private void butOK_Click(object sender, EventArgs e)
        {
            List <string> err = new List <string>();

            if (this.fileSave.Equals(""))
            {
                this.fileSave = file.GetSaveFilePath();
            }
            if (this.fileSave.Equals(""))
            {
                ClassItem.MessageBox("请选择保存文件位置", NXMessageBox.DialogType.Error);
                return;
            }
            foreach (CreateElectrodeCAMBuilder cb in this.camBd)
            {
                if (cb.Template.Type == ElectrodeTemplate.User)
                {
                    err.AddRange(cb.CreateUserOperation());
                }
                else
                {
                    err.AddRange(cb.CreateOperation());
                }

                cb.SetGenerateToolPath(this.checkBoxIsGenerate.Checked);
                err.AddRange(cb.ExportFile(this.fileSave, true));
                elePart.Remove(cb.Pt);
            }
            if (err.Count > 0)
            {
                ClassItem.Print(err.ToArray());
            }
            this.Close();
        }
        //------------------------------------------------------------------------------
        //Callback Name: apply_cb
        //------------------------------------------------------------------------------
        public int apply_cb()
        {
            int errorCode = 0;

            try
            {
                //---- Enter your callback code here -----

                if (selectiObj.GetSelectedObjects().Length > 0)
                {
                    analyze = new AnalyzeBuilder(selectiObj.GetSelectedObjects()[0] as NXObject);
                    analyze.Analyze(vector.Vector);
                    if (color.Value)
                    {
                        analyze.SetSlopeEqualColor();
                    }
                    if (analyze.IsBackOff)
                    {
                        ClassItem.MessageBox("红色面有倒扣!\n 最小半径 :" + analyze.MinRadius.ToString(), NXMessageBox.DialogType.Error);
                    }
                    else
                    {
                        ClassItem.MessageBox($"最小半径 :" + analyze.MinRadius.ToString(), NXMessageBox.DialogType.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                //---- Enter your exception handling code here -----
                errorCode = 1;
                theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
            }
            return(errorCode);
        }
Exemple #4
0
 public bool CreatPart()
 {
     if (File.Exists(this.directoryPath + EleModel.AssembleName + ".prt"))
     {
         ClassItem.MessageBox("电极重名!", NXMessageBox.DialogType.Error);
         return(false);
     }
     try
     {
         this.EleComp = this.EleModel.CreateCompPart(this.directoryPath);
         // this.EleModel.Info.SetAttribute(this.EleComp);
         return(true);
     }
     catch (NXException ex)
     {
         ClassItem.WriteLogFile("创建Part档错误!" + ex.Message);
         return(false);
     }
 }
 /// <summary>
 /// 查找选择电极Part
 /// </summary>
 /// <returns></returns>
 private Part FindSelectEle()
 {
     if (dataGridViewEle.SelectedCells.Count > 0)
     {
         int     intRow = dataGridViewEle.SelectedCells[0].RowIndex;
         DataRow dr     = (dataGridViewEle.Rows[intRow].DataBoundItem as DataRowView).Row;
         string  name   = dr["EleName"].ToString();
         if (name != null && !name.Equals(""))
         {
             Part pt = elePart.Find(a => a.Name.Equals(name));
             if (pt != null)
             {
                 return(pt);
             }
         }
     }
     else
     {
         ClassItem.MessageBox("请选择电极!", NXMessageBox.DialogType.Error);
     }
     return(null);
 }
        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);
            }
        }