Beispiel #1
0
        /// <summary>
        /// 替换工件
        /// </summary>
        /// <param name="ct"></param>
        private void AlterWorkpiece(NXOpen.Assemblies.Component ct, UserModel user)
        {
            MoldInfo mold;

            if (!ParentAssmblieInfo.IsParent(ct))
            {
                mold = new MoldInfo()
                {
                    MoldNumber      = this.strMoldNumber.Value.ToUpper(),
                    WorkpieceNumber = this.strWorkpieceNumber.Value.ToUpper(),
                    EditionNumber   = this.strEditionNumber.Value.ToUpper()
                };
            }
            else
            {
                mold                 = MoldInfo.GetAttribute(ct);
                mold.MoldNumber      = this.strMoldNumber.Value;
                mold.WorkpieceNumber = this.strWorkpieceNumber.Value;
                mold.EditionNumber   = this.strEditionNumber.Value;
            }
            WorkPieceInfo wk      = new WorkPieceInfo(mold, user);
            string        newName = mold.MoldNumber + "-" + mold.WorkpieceNumber + "-" + mold.EditionNumber;
            Part          pt      = ct.Prototype as Part;
            ReplaceOther  ot      = new ReplaceOther(pt, wk);
            List <string> err     = ot.Alter(newName);

            if (err.Count > 0)
            {
                ClassItem.Print(err.ToArray());
            }
        }
Beispiel #2
0
        /// <summary>
        /// 替换WORK
        /// </summary>
        /// <param name="wks"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        private List <string> AlterWork(List <WorkModel> wks, ParentAssmblieInfo info)
        {
            List <string> err  = new List <string>();
            string        temp = info.MoldInfo.MoldNumber + "-" + info.MoldInfo.WorkpieceNumber;

            info.Type = PartType.Work;
            foreach (WorkModel wm in wks)
            {
                string       workName = temp + "-WORK" + wm.Info.WorkNumber;
                ReplaceOther rep      = new ReplaceOther(wm.PartTag, info);
                err.AddRange(rep.Alter(workName));
            }
            return(err);
        }
Beispiel #3
0
        /// <summary>
        /// 替换工件
        /// </summary>
        /// <param name="ct"></param>
        private void AlterWork(NXOpen.Assemblies.Component ct, UserModel user)
        {
            int           workNumber = this.intWorkNumber.Value;
            string        newName    = info.MoldInfo.MoldNumber + "-" + info.MoldInfo.WorkpieceNumber + "-WORK" + workNumber.ToString();;
            WorkInfo      workInfo   = new WorkInfo(info.MoldInfo, user, workNumber, (info as WorkInfo).Matr);
            Part          pt         = ct.Prototype as Part;
            ReplaceOther  ot         = new ReplaceOther(pt, workInfo);
            List <string> err        = ot.Alter(newName);

            if (err.Count > 0)
            {
                ClassItem.Print(err.ToArray());
            }
        }
Beispiel #4
0
        private List <string> AlterAsm(ASMModel asm, ParentAssmblieInfo info)
        {
            List <string> err = new List <string>();
            bool          anyPartsModified1;

            NXOpen.PartSaveStatus partSaveStatus1;
            theSession.Parts.SaveAll(out anyPartsModified1, out partSaveStatus1);
            info.Type = PartType.ASM;
            string       temp = info.MoldInfo.MoldNumber + "-" + info.MoldInfo.WorkpieceNumber;
            string       name = temp + "-ASM";
            ReplaceOther rep  = new ReplaceOther(asm.PartTag, info);

            err.AddRange(rep.Alter(name));
            return(err);
        }
Beispiel #5
0
        /// <summary>
        /// 修改EDM
        /// </summary>
        /// <param name="edms"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        private List <string> AlterEdm(List <EDMModel> edms, ParentAssmblieInfo info)
        {
            List <string> err  = new List <string>();
            string        temp = info.MoldInfo.MoldNumber + "-" + info.MoldInfo.WorkpieceNumber;

            info.Type = PartType.EDM;
            foreach (EDMModel em in edms)
            {
                string       old     = em.Info.MoldInfo.MoldNumber + "-" + em.Info.MoldInfo.WorkpieceNumber;
                string       edmName = em.AssembleName.Replace(old, temp);
                ReplaceOther rep     = new ReplaceOther(em.PartTag, info);
                err.AddRange(rep.Alter(edmName));
            }
            return(err);
        }