Ejemplo n.º 1
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;
                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);
        }
Ejemplo n.º 2
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) || 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);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 设置对话框显示
 /// </summary>
 private void SetDisp(NXOpen.Assemblies.Component ct)
 {
     if (ParentAssmblieInfo.IsElectrode(ct))
     {
         this.groupEle.Show = true;
         info = ElectrodeInfo.GetAttribute(ct);
         //this.strMoldNumber.Show = false;
         // this.strWorkpieceNumber.Show = false;
         // this.strEditionNumber.Show = false;
         this.groupWorkpiece.Show = false;
         this.groupWork.Show      = false;
         ElectrodeInfo eleInfo = info as ElectrodeInfo;
         string        temp    = info.MoldInfo.MoldNumber + "-" + info.MoldInfo.WorkpieceNumber;
         this.strEleName.Value          = temp;
         this.strEleName1.Value         = eleInfo.AllInfo.Name.EleName.Substring(temp.Length, eleInfo.AllInfo.Name.EleName.Length - temp.Length);
         this.strEleEditionNumber.Value = eleInfo.AllInfo.Name.EleEditionNumber;
     }
     else if (ParentAssmblieInfo.IsWorkpiece(ct))
     {
         info = WorkPieceInfo.GetAttribute(ct);
         this.groupWorkpiece.Show      = true;
         this.groupEle.Show            = false;
         this.groupWork.Show           = false;
         this.strMoldNumber.Value      = info.MoldInfo.MoldNumber;
         this.strWorkpieceNumber.Value = info.MoldInfo.WorkpieceNumber;
         this.strEditionNumber.Value   = info.MoldInfo.EditionNumber;
     }
     else if (ParentAssmblieInfo.IsWork(ct))
     {
         info = WorkInfo.GetAttribute(ct);
         this.groupWork.Show      = true;
         this.groupEle.Show       = false;
         this.groupWorkpiece.Show = false;
         this.intWorkNumber.Value = (info as WorkInfo).WorkNumber;
     }
     else if (!ParentAssmblieInfo.IsParent(ct))
     {
         this.groupWorkpiece.Show      = true;
         this.groupEle.Show            = false;
         this.strWorkpieceNumber.Value = ct.Name;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 判断是否是工件
 /// </summary>
 /// <returns></returns>
 public bool IsWorkpiece()
 {
     return(ParentAssmblieInfo.IsWorkpiece(this.pt) || !ParentAssmblieInfo.IsParent(this.pt));
 }