예제 #1
0
        /// <summary>
        ///获取有电极程序模板的电极
        /// </summary>
        /// <returns></returns>
        private List <Part> GetElePartForCamInfo()
        {
            List <Part> elePart = new List <Part>();

            Session theSession = Session.GetSession();

            foreach (Part pt in theSession.Parts)
            {
                if (ParentAssmblieInfo.IsElectrode(pt))
                {
                    ElectrodeCAMInfo cam = ElectrodeCAMInfo.GetAttribute(pt);
                    if (cam.CamTemplate == null || cam.CamTemplate != "")
                    {
                        elePart.Add(pt);
                    }
                }
            }
            return(elePart);
        }
예제 #2
0
        private static List <string> CreateBuider(string partPath)
        {
            List <string> err   = new List <string>();
            Tag           ptTag = Tag.Null;

            UFPart.LoadStatus load;
            ElectrodeCAMFile  file    = new ElectrodeCAMFile();
            List <string>     newPath = file.CopyFile(partPath);

            try
            {
                theUfSession.Part.Open(newPath[0], out ptTag, out load);
            }
            catch (NXException ex)
            {
                err.Add("打开文件失败!           " + ex.Message);
                return(err);
            }
            Part   pt   = NXObjectManager.Get(ptTag) as Part;
            string name = pt.Name;

            if (pt != null)
            {
                UserModel                 user    = UserModel.GetAttribute(pt);
                ElectrodeCAMInfo          cam     = ElectrodeCAMInfo.GetAttribute(pt);
                CreateElectrodeCAMBuilder builder = new CreateElectrodeCAMBuilder(pt, user);
                builder.CreateOperationNameModel(GetTemplate(cam.CamTemplate));
                err.AddRange(builder.CreateOperationExe());
                builder.SetGenerateToolPath(true);
                string path = file.GetSaveFilePath();
                if (path != null && path != "")
                {
                    builder.ExportFile(path, false);
                }
                else
                {
                    builder.ExportFile("C:\\temp\\Electrode\\", false);
                }
                err.Add("电极" + name + "*************导出成功!");
            }
            return(err);
        }