创建程式组的操作

 try
            {
                int total = int.Parse(tBox_PGNum.Text);//取得输入的数量
                string begin_str = tBox_BeginChar.Text;
                int begin = int.Parse(Regex.Match(begin_str, @"\d+[^\d]*$").ToString());//取得输入开始字符的最后一组数字

                begin_str = begin_str.Substring(0, begin_str.LastIndexOf(begin.ToString()));//取得要生成程式组前段字符

                for (int i = begin; i < total + begin; i++)
                {
                    thePart.CAMSetup.CAMGroupCollection.CreateProgram((NXOpen.CAM.NCGroup)m_UI.SelectionManager.GetSelectedObject(0), "mill_contour", "PROGRAM", NXOpen.CAM.NCGroupCollection.UseDefaultName.False, begin_str + i);
                }

                Lbl_waring.Text = "程序组已创建";

            }
            catch (NXException ex)//引用 NXOPEN.Utilities
            {
                m_UI.NXMessageBox.Show("error!", NXMessageBox.DialogType.Error, ex.Message);

            }

 

posted @ 2014-01-20 16:40  yizongxing  阅读(313)  评论(0编辑  收藏  举报