Exemple #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());
            }
        }
 public CreateElectrode(ElectrodeAllInfo allInfo, ParentAssmblieInfo parent, ElectrodeCreateCondition condition, bool zDatum)
 {
     this.allInfo   = allInfo;
     this.parent    = parent;
     this.condition = condition;
     this.zDatum    = zDatum;
 }
Exemple #3
0
 //------------------------------------------------------------------------------
 //This method shows the dialog on the screen
 //------------------------------------------------------------------------------
 public NXOpen.UIStyler.DialogResponse Show()
 {
     try
     {
         UserSingleton user = UserSingleton.Instance();
         if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd())
         {
             Part workPart = theSession.Parts.Work;
             if (!ParentAssmblieInfo.IsAsm(workPart))
             {
                 ASMModel asm = ASMCollection.GetAsmModel(workPart);
                 if (asm != null)
                 {
                     PartUtils.SetPartDisplay(asm.PartTag);
                 }
                 else
                 {
                     theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "工作部件无法找到ASM档!");
                     return(0);
                 }
             }
             theDialog.Show();
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }
Exemple #4
0
 //------------------------------------------------------------------------------
 //This method shows the dialog on the screen
 //------------------------------------------------------------------------------
 public NXOpen.UIStyler.DialogResponse Show()
 {
     try
     {
         UserSingleton user = UserSingleton.Instance();
         if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd())
         {
             Part workPart = theSession.Parts.Work;
             if (!ParentAssmblieInfo.IsWork(workPart))
             {
                 theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换到WORK为显示部件!");
                 return(0);
             }
             WorkModel model = new WorkModel(workPart);
             this.matr = model.Info.Matr;
             theDialog.Show();
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }
Exemple #5
0
 //------------------------------------------------------------------------------
 //Callback Name: filter_cb
 //------------------------------------------------------------------------------
 public int filter_cb(NXOpen.BlockStyler.UIBlock block, NXOpen.TaggedObject selectedObject)
 {
     TaggedObject[] obj = this.selePart.GetSelectedObjects();
     if (selectedObject is NXOpen.Assemblies.Component)
     {
         Part part = (selectedObject as NXOpen.Assemblies.Component).Prototype as Part;
         ParentAssmblieInfo info = ParentAssmblieInfo.GetAttribute(part);
         if (info.Type == PartType.Workpiece || info.Type == PartType.Work)
         {
             return(NXOpen.UF.UFConstants.UF_UI_SEL_ACCEPT);
         }
     }
     if (obj.Length > 0)
     {
         //  Part part = (obj[0] as NXOpen.Assemblies.Component).Prototype as Part;
         if (selectedObject is Face)
         {
             Face seleFace = selectedObject as Face;
             Part selePart = (seleFace.Prototype as Face).OwningPart as Part;
             if (selePart.Tag == this.selectPart.Tag)
             {
                 return(UFConstants.UF_UI_SEL_ACCEPT);
             }
         }
         else if (selectedObject is Point)
         {
             return(UFConstants.UF_UI_SEL_ACCEPT);
         }
     }
     return(NXOpen.UF.UFConstants.UF_UI_SEL_REJECT);
 }
Exemple #6
0
        /// <summary>
        /// 替换电极图纸
        /// </summary>
        /// <param name="oldParenInfo"></param>
        /// <param name="newParenInfo"></param>
        /// <returns></returns>
        public List <string> AlterEleDra(ParentAssmblieInfo oldParenInfo, ParentAssmblieInfo newParenInfo)
        {
            List <string> err          = new List <string>();
            UFSession     theUFSession = UFSession.GetUFSession();
            Part          workPart     = Session.GetSession().Parts.Work;
            string        oldDra       = directoryPath + oldNameInfo.EleName + "_dwg.prt";

            if (!File.Exists(oldDra))
            {
                return(err);
            }
            string newDra = directoryPath + newNameInfo.EleName + "_dwg.prt";

            if (File.Exists(newDra))
            {
                err.Add(newNameInfo.EleName + "            替换失败,替换后有同名工件!          ");
                return(err);
            }
            else
            {
                foreach (Part pt in Session.GetSession().Parts)
                {
                    if (pt.Name.Equals(oldNameInfo.EleName + "_dwg", StringComparison.CurrentCultureIgnoreCase))
                    {
                        pt.Close(NXOpen.BasePart.CloseWholeTree.False, NXOpen.BasePart.CloseModified.UseResponses, null);
                    }
                }
                File.Move(oldDra, newDra);
                Tag partTag;
                UFPart.LoadStatus error_status;
                theUFSession.Part.Open(newDra, out partTag, out error_status);
                Part newPart = NXObjectManager.Get(partTag) as Part;

                PartUtils.SetPartDisplay(newPart);
                NXOpen.Assemblies.Component comp = newPart.ComponentAssembly.RootComponent.GetChildren()[0];
                string workName = comp.Name.Replace(oldParenInfo.MoldInfo.MoldNumber + "-" + oldParenInfo.MoldInfo.WorkpieceNumber, newParenInfo.MoldInfo.MoldNumber + "-" + newParenInfo.MoldInfo.WorkpieceNumber);
                try
                {
                    Basic.AssmbliesUtils.ReplaceComp(comp, this.directoryPath + workName + ".prt", workName);
                }
                catch
                {
                }
                if (newPart != null)
                {
                    newNameInfo.SetAttribute(newPart);
                    ParentAssmblieInfo info = ParentAssmblieInfo.GetAttribute(newPart);
                    info.MoldInfo  = newParenInfo.MoldInfo;
                    info.UserModel = newParenInfo.UserModel;
                    info.SetAttribute(newPart);
                    foreach (DrawingSheet st in newPart.DrawingSheets)
                    {
                        Basic.DrawingUtils.UpdateViews(st);
                    }
                }
                PartUtils.SetPartDisplay(workPart);
                err.Add(newNameInfo.EleName + "           图纸替换成功!          ");
                return(err);
            }
        }
        //------------------------------------------------------------------------------
        //Callback Name: apply_cb
        //------------------------------------------------------------------------------
        public int apply_cb()
        {
            int errorCode = 0;

            try
            {
                //---- Enter your callback code here -----
                NXOpen.Assemblies.Component ct = seleComp.GetSelectedObjects()[0] as NXOpen.Assemblies.Component;
                if (ParentAssmblieInfo.IsElectrode(ct))
                {
                    AlterEle(ct);
                }
                else if (ParentAssmblieInfo.IsWork(ct))
                {
                    AlterWork(ct, user.CreatorUser);
                }
                else if (ParentAssmblieInfo.IsWorkpiece(ct) || !ParentAssmblieInfo.IsParent(ct))
                {
                    AlterWorkpiece(ct, user.CreatorUser);
                }

                bool           anyPartsModified;
                PartSaveStatus saveStatus;
                theSession.Parts.SaveAll(out anyPartsModified, out saveStatus);
            }
            catch (Exception ex)
            {
                //---- Enter your exception handling code here -----
                errorCode = 1;
                theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
            }
            return(errorCode);
        }
Exemple #8
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);
        }
        public ReplaceOther(Part pt, ParentAssmblieInfo info)
        {
            this.pt = pt;
            string oldPath = pt.FullPath;

            this.directoryPath = Path.GetDirectoryName(oldPath) + "\\";
            this.newInfo       = info;
        }
Exemple #10
0
 public EleStandardSeatForm(ElectrodeCreateCondition condition, WorkModel work, ParentAssmblieInfo parent)
 {
     this.condition = condition;
     this.parent    = parent;
     this.work      = work;
     preveiw        = new ElectrodePreveiw(condition.HeadBodys, work.Info.Matr);
     InitializeComponent();
     InitializeForm();
 }
Exemple #11
0
        //------------------------------------------------------------------------------
        //Callback Name: apply_cb
        //------------------------------------------------------------------------------
        public int apply_cb()
        {
            int errorCode = 0;

            try
            {
                //---- Enter your callback code here -----
                NXOpen.Assemblies.Component ct = seleComp.GetSelectedObjects()[0] as NXOpen.Assemblies.Component;
                Part workPart = theSession.Parts.Work;
                if (ct != null)
                {
                    List <string> err = new List <string>();
                    bool          isBorrow;
                    if (this.enum0.ValueAsString == "借用电极")
                    {
                        isBorrow = true;
                    }
                    else
                    {
                        isBorrow = false;
                    }
                    MoldInfo old  = MoldInfo.GetAttribute(ct);
                    MoldInfo mold = new MoldInfo()
                    {
                        MoldNumber      = this.MoldNumber.WideValue.ToUpper(),
                        WorkpieceNumber = this.PartNumber.WideValue.ToUpper(),
                        ClientName      = this.ClientNumber.WideValue.ToUpper(),
                        EditionNumber   = this.EditionNumber.WideValue.ToUpper(),
                        MoldType        = old.MoldType
                    };
                    ParentAssmblieInfo info   = new ParentAssmblieInfo(mold, user.CreatorUser);
                    WorkCollection     wkColl = asmColl.GetWorkCollection(old);
                    err.AddRange(AlterWork(wkColl.Work, info));
                    err.AddRange(AlterEdm(wkColl.EdmModel, info));
                    err.AddRange(AlterElectrode(wkColl.Electrodes, info, isBorrow));
                    PartUtils.SetPartDisplay(workPart);
                    ASMModel asm = new ASMModel(workPart);
                    if (asm.Info.MoldInfo.Equals(old))
                    {
                        err.AddRange(AlterAsm(asm, info));
                    }
                    if (err.Count > 0)
                    {
                        ClassItem.Print(err.ToArray());
                    }
                }
            }
            catch (Exception ex)
            {
                //---- Enter your exception handling code here -----
                errorCode = 1;
                theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
            }
            return(errorCode);
        }
Exemple #12
0
 public int filter_cb(NXOpen.BlockStyler.UIBlock block, NXOpen.TaggedObject selectedObject)
 {
     if (selectedObject is NXOpen.Assemblies.Component)
     {
         if (ParentAssmblieInfo.IsWork(selectedObject as NXOpen.Assemblies.Component))
         {
             return(NXOpen.UF.UFConstants.UF_UI_SEL_ACCEPT);
         }
     }
     return(NXOpen.UF.UFConstants.UF_UI_SEL_REJECT);
 }
        /// <summary>
        /// 弹出对话框
        /// </summary>
        private void ShowForm(ElectrodeCreateCondition condition, ParentAssmblieInfo parent, WorkModel work)
        {
            EleStandardSeatForm form = new EleStandardSeatForm(condition, work, parent);
            IntPtr intPtr            = NXOpenUI.FormUtilities.GetDefaultParentWindowHandle();

            NXOpenUI.FormUtilities.ReparentForm(form);
            NXOpenUI.FormUtilities.SetApplicationIcon(form);
            // form.Show();
            Application.Run(form);
            form.Dispose();
        }
Exemple #14
0
 /// <summary>
 /// 获取电极号
 /// </summary>
 /// <returns></returns>
 public string GetEleName()
 {
     if (ParentAssmblieInfo.IsElectrode(this.pt))
     {
         ElectrodeNameInfo name = ElectrodeNameInfo.GetAttribute(this.pt);
         if (pt.Name.Equals(name.EleName, StringComparison.CurrentCultureIgnoreCase))
         {
             return(name.EleName);
         }
     }
     return(pt.Name);
 }
Exemple #15
0
 //------------------------------------------------------------------------------
 //Callback Name: filter_cb
 //------------------------------------------------------------------------------
 public int filter_cb(NXOpen.BlockStyler.UIBlock block, NXOpen.TaggedObject selectedObject)
 {
     NXOpen.Assemblies.Component ct = (selectedObject as NXOpen.Assemblies.Component);
     if (ct != null)
     {
         if (!ParentAssmblieInfo.IsElectrode(ct))
         {
             return(UFConstants.UF_UI_SEL_REJECT);
         }
     }
     return(NXOpen.UF.UFConstants.UF_UI_SEL_ACCEPT);
 }
 //------------------------------------------------------------------------------
 //Callback Name: filter_cb
 //------------------------------------------------------------------------------
 public int filter_cb(NXOpen.BlockStyler.UIBlock block, NXOpen.TaggedObject selectedObject)
 {
     NXOpen.Assemblies.Component ct = selectedObject as NXOpen.Assemblies.Component;
     if (ct != null)
     {
         if (ParentAssmblieInfo.IsElectrode(ct) || ParentAssmblieInfo.IsWorkpiece(ct) || !ParentAssmblieInfo.IsParent(ct) || ParentAssmblieInfo.IsWork(ct))
         {
             return(NXOpen.UF.UFConstants.UF_UI_SEL_ACCEPT);
         }
     }
     return(NXOpen.UF.UFConstants.UF_UI_SEL_FAILURE);
 }
        /// <summary>
        /// 获取电极Component
        /// </summary>
        /// <returns></returns>
        public List <NXOpen.Assemblies.Component> GetElectrodeComponent()
        {
            List <NXOpen.Assemblies.Component> eleCt = new List <NXOpen.Assemblies.Component>();

            foreach (NXOpen.Assemblies.Component ct in this.workCt.GetChildren())
            {
                if (ParentAssmblieInfo.IsElectrode(ct))
                {
                    eleCt.Add(ct);
                }
            }
            return(eleCt);
        }
        /// <summary>
        /// 获取EDM
        /// </summary>
        /// <returns></returns>
        public EDMModel GetEDMModel()
        {
            EDMModel model = null;

            foreach (NXOpen.Assemblies.Component ct in this.workCt.GetChildren())
            {
                if (ParentAssmblieInfo.IsEDM(ct))
                {
                    model = new EDMModel(ct.Prototype as Part);
                }
            }
            return(model);
        }
        public int filter_cb(NXOpen.BlockStyler.UIBlock block, NXOpen.TaggedObject selectedObject)
        {
            if (selectedObject is NXOpen.Assemblies.Component)
            {
                Part part = (selectedObject as NXOpen.Assemblies.Component).Prototype as Part;
                ParentAssmblieInfo info = ParentAssmblieInfo.GetAttribute(part);
                if (info.Type == PartType.Electrode)
                {
                    return(NXOpen.UF.UFConstants.UF_UI_SEL_ACCEPT);
                }
            }

            return(NXOpen.UF.UFConstants.UF_UI_SEL_REJECT);
        }
Exemple #20
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);
        }
Exemple #21
0
 //------------------------------------------------------------------------------
 //Callback Name: update_cb
 //------------------------------------------------------------------------------
 public int update_cb(NXOpen.BlockStyler.UIBlock block)
 {
     try
     {
         if (block == seleComp)
         {
             //---------Enter your code here-----------
             TaggedObject[] objs = seleComp.GetSelectedObjects();
             if (objs.Length > 0)
             {
                 NXOpen.Assemblies.Component ct = objs[0] as NXOpen.Assemblies.Component;
                 if (ct != null)
                 {
                     if (ParentAssmblieInfo.IsParent(ct))
                     {
                         MoldInfo mold = MoldInfo.GetAttribute(ct);
                         this.ClientNumber.Value = mold.ClientName;
                     }
                 }
             }
         }
         else if (block == MoldNumber)
         {
             //---------Enter your code here-----------
         }
         else if (block == PartNumber)
         {
             //---------Enter your code here-----------
         }
         else if (block == EditionNumber)
         {
             //---------Enter your code here-----------
         }
         else if (block == ClientNumber)
         {
             //---------Enter your code here-----------
         }
         else if (block == enum0)
         {
             //---------Enter your code here-----------
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(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))
                {
                    elePart.Add(pt);
                }
            }
            return(elePart);
        }
Exemple #23
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);
        }
Exemple #24
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);
        }
Exemple #25
0
        private void Initialize()
        {
            Part workPart = Session.GetSession().Parts.Work;

            if (ParentAssmblieInfo.IsElectrode(workPart))
            {
                this.listBoxPostName.SelectedIndex = 4;
            }
            foreach (ProgramModel np in models)
            {
                groups.Add(np.ProgramGroup);
                ListViewItem lv = new ListViewItem();
                lv.SubItems.Add(np.ProgramGroup.Name);
                lv.Checked = true;
                listViewProgram.Items.Add(lv);
            }
        }
        private List <string> CreateNewWork1(NXOpen.Assemblies.Component ct, WorkpieceModel workpiece, Matrix4 mat, UserModel user)
        {
            List <string> err      = new List <string>();
            MoldInfo      moldInfo = workpiece.Info.MoldInfo;
            int           num      = asmColl.GetWorkCollection(moldInfo).Work.Count;
            WorkInfo      workInfo = new WorkInfo(workpiece.Info.MoldInfo, user, num + 1, mat);
            string        workName = workInfo.MoldInfo.MoldNumber + "-" + workInfo.MoldInfo.WorkpieceNumber + "-" + "WORK" + workInfo.WorkNumber.ToString();
            EDMModel      edm      = GetEdm(ct);

            if (edm == null)
            {
                err.Add("获取EDM错误");
                return(err);
            }
            NXOpen.Assemblies.Component comp = AssmbliesUtils.MoveCompCopyPart(ct.Parent.Parent, new Vector3d(0, 0, 0), mat);
            AssmbliesUtils.MakeUnique(comp, edm.WorkpieceDirectoryPath + workName + ".prt");
            workInfo.SetAttribute(comp.Prototype as Part);
            WorkModel wm = new WorkModel(comp.Prototype as Part);

            if (wm != null)
            {
                wm.SaveCsys(workPart);
            }
            if (!edm.Info.MoldInfo.Equals(workInfo.MoldInfo))
            {
                EDMInfo edmInfo = new EDMInfo(workInfo.MoldInfo, workInfo.UserModel);
                string  edmName = edmInfo.MoldInfo.MoldNumber + "-" + edmInfo.MoldInfo.WorkpieceNumber + "-" + "EDM";
                foreach (NXOpen.Assemblies.Component cp in comp.GetChildren())
                {
                    if (ParentAssmblieInfo.IsEDM(cp))
                    {
                        AssmbliesUtils.MakeUnique(cp, edm.WorkpieceDirectoryPath + edmName + ".prt");
                        edmInfo.SetAttribute(cp.Prototype as Part);
                        foreach (NXOpen.Assemblies.Component co in cp.GetChildren())
                        {
                            if (!(co.Prototype as Part).Equals(workpiece.PartTag))
                            {
                                AssmbliesUtils.DeleteComponent(co);
                            }
                        }
                    }
                }
            }
            return(err);
        }
Exemple #27
0
 /// <summary>
 /// 获取间隙
 /// </summary>
 /// <returns></returns>
 public ElectrodeGapValueInfo GetGapValueInfo()
 {
     if (ParentAssmblieInfo.IsElectrode(this.pt))
     {
         return(ElectrodeGapValueInfo.GetAttribute(this.pt));
     }
     else
     {
         return(new ElectrodeGapValueInfo()
         {
             CrudeInter = 0,
             CrudeNum = 0,
             DuringInter = 0,
             DuringNum = 0,
             FineInter = 0,
             FineNum = 0
         });
     }
 }
        /// <summary>
        /// 获取工件Part
        /// </summary>
        /// <returns></returns>
        private List <NXOpen.Assemblies.Component> GetWorkpieces()
        {
            List <NXOpen.Assemblies.Component> workpiece = new List <NXOpen.Assemblies.Component>();

            foreach (NXOpen.Assemblies.Component ct in this.workCt.GetChildren())
            {
                if (ParentAssmblieInfo.IsEDM(ct))
                {
                    foreach (NXOpen.Assemblies.Component cp in ct.GetChildren())
                    {
                        if (!workpiece.Exists(a => a.Equals(cp)))
                        {
                            workpiece.Add(cp);
                        }
                    }
                }
            }
            return(workpiece);
        }
Exemple #29
0
 /// <summary>
 /// 获取模具号
 /// </summary>
 /// <returns></returns>
 public MoldInfo GetMoldInfo()
 {
     if (ParentAssmblieInfo.IsParent(this.pt))
     {
         return(MoldInfo.GetAttribute(this.pt));
     }
     else
     {
         return(new MoldInfo()
         {
             ClientName = "",
             EditionNumber = "",
             MachineType = "",
             MoldNumber = "",
             MoldType = "",
             WorkpieceNumber = ""
         });
     }
 }
        /// <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);
        }