Beispiel #1
0
        /// <summary>
        /// 添加文件
        /// </summary>
        /// <param name="filePh"></param>
        /// <returns></returns>
        public List <string> AddFile(string filePh)
        {
            List <string> filePath = new List <string>();
            List <string> oldPath  = OpenFileUtils.OpenFiles("添加工件", "部件文件(*.prt*)|");

            if (oldPath.Count > 0)
            {
                if (!Directory.Exists(filePh))
                {
                    return(filePath);
                }
                foreach (string st in oldPath)
                {
                    string temp = Path.GetFileName(st);
                    File.Copy(st, filePh + temp);
                    filePath.Add(filePh + temp);
                }
            }
            return(filePath);
        }
Beispiel #2
0
        /// <summary>
        /// 移动文件
        /// </summary>
        /// <returns></returns>
        public List <string> CopyFile()
        {
            List <string> filePath = new List <string>();
            List <string> oldPath  = OpenFileUtils.OpenFiles("添加工件", "部件文件(*.prt*)|");

            if (oldPath.Count > 0)
            {
                eleFile = camFile + GetTimeStamp() + "\\";
                if (!Directory.Exists(eleFile))
                {
                    Directory.CreateDirectory(eleFile);
                }
                foreach (string st in oldPath)
                {
                    string temp = Path.GetFileName(st);
                    File.Copy(st, eleFile + temp);
                    filePath.Add(eleFile + temp);
                }
            }
            return(filePath);
        }
 //------------------------------------------------------------------------------
 //Callback Name: update_cb
 //------------------------------------------------------------------------------
 public int update_cb(NXOpen.BlockStyler.UIBlock block)
 {
     try
     {
         if (block == seleEdm)
         {
             //---------Enter your code here-----------
             TaggedObject[] tg = seleEdm.GetSelectedObjects();
             if (tg.Length > 0)
             {
                 this.buttFile.Enable = true;
                 NXOpen.Assemblies.Component ct = tg[0] as NXOpen.Assemblies.Component;
                 edm = new EDMModel(ct.Prototype as Part);
                 this.strMoldNumber.Value    = edm.Info.MoldInfo.MoldNumber;
                 this.strEditionNumber.Value = edm.Info.MoldInfo.EditionNumber;
             }
         }
         else if (block == strMoldNumber)
         {
             //---------Enter your code here-----------
         }
         else if (block == strEditionNumber)
         {
             //---------Enter your code here-----------
         }
         else if (block == buttFile)
         {
             //---------Enter your code here-----------
             partPaths = OpenFileUtils.OpenFiles("添加工件", "部件文件(*.prt*)|");
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }