private static bool PartIsAsm(out List <ProgramModel> groups)
        {
            Session theSession = Session.GetSession();

            NXOpen.UI theUI = NXOpen.UI.GetUI();
            groups = new List <ProgramModel>();
            if (!theSession.ApplicationName.Equals("UG_APP_MANUFACTURING", StringComparison.CurrentCultureIgnoreCase))
            {
                theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换到加工模块");
                return(false);
            }
            group = GetNCGroup();
            if (group == null)
            {
                theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "没法找到AAA程序组");
                return(false);
            }

            ProgramModel model = new ProgramModel(group);

            if (model.OperData.Count > 0)
            {
                theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "程序组错误");
                return(false);
            }
            foreach (NCGroup np in model.GetProgram())
            {
                if (np.GetMembers().Length > 0)
                {
                    ProgramModel nc = new ProgramModel(np);
                    if (!nc.IsOperation() || !nc.Estimate)
                    {
                        theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, np.Name + "错误");
                        return(false);
                    }
                    else
                    {
                        groups.Add(nc);
                    }
                }
            }
            List <string> err = new List <string>();

            foreach (ProgramModel pm in groups)
            {
                err.AddRange(pm.Gouged());
            }
            if (err.Count > 0)
            {
                int ok = theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Question, "程序过切!");
                if (ok == 2)
                {
                    ClassItem.Print(err.ToArray());
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 public MooldePluginMain()
 {
     try
     {
         theSession      = Session.GetSession();
         theUI           = NXOpen.UI.GetUI();
         theUfSession    = UFSession.GetUFSession();
         isDisposeCalled = false;
     }
     catch (NXOpen.NXException ex)
     {
         // ---- Enter your exception handling code here -----
         NXOpen.UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.Error, ex.Message);
     }
 }
        private static NXOpen.CAM.NCGroup GetNCGroup()
        {
            Part workPart = Session.GetSession().Parts.Work;

            NXOpen.UI theUI = NXOpen.UI.GetUI();
            try
            {
                NXOpen.CAM.NCGroup parent = (NXOpen.CAM.NCGroup)workPart.CAMSetup.CAMGroupCollection.FindObject("AAA");
                return(parent);
            }
            catch
            {
                theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "无法找到  AAA");
            }
            return(null);
        }
Exemplo n.º 4
0
        private NXOpen.BlockStyler.SelectObject Selection1; // Block type: Selection

        //------------------------------------------------------------------------------
        //Constructor for NX Styler class
        //------------------------------------------------------------------------------
        public CheckElectrode()
        {
            try
            {
                theSession     = Session.GetSession();
                theUI          = NXOpen.UI.GetUI();
                theDlxFileName = "CheckElectrode.dlx";
                theDialog      = theUI.CreateDialog(theDlxFileName);
                theDialog.AddApplyHandler(new NXOpen.BlockStyler.BlockDialog.Apply(apply_cb));
                theDialog.AddOkHandler(new NXOpen.BlockStyler.BlockDialog.Ok(ok_cb));
                theDialog.AddUpdateHandler(new NXOpen.BlockStyler.BlockDialog.Update(update_cb));
                theDialog.AddInitializeHandler(new NXOpen.BlockStyler.BlockDialog.Initialize(initialize_cb));
                theDialog.AddDialogShownHandler(new NXOpen.BlockStyler.BlockDialog.DialogShown(dialogShown_cb));
            }
            catch (Exception ex)
            {
                //---- Enter your exception handling code here -----
                throw ex;
            }
        }
Exemplo n.º 5
0
 //------------------------------------------------------------------------------
 //Constructor for NX Styler class
 //------------------------------------------------------------------------------
 public MoveComponent()
 {
     try
     {
         theSession     = Session.GetSession();
         theUI          = NXOpen.UI.GetUI();
         workPart       = theSession.Parts.Work;
         theDlxFileName = "MoveComponent.dlx";
         theDialog      = theUI.CreateDialog(theDlxFileName);
         theDialog.AddApplyHandler(new NXOpen.BlockStyler.BlockDialog.Apply(apply_cb));
         theDialog.AddOkHandler(new NXOpen.BlockStyler.BlockDialog.Ok(ok_cb));
         theDialog.AddUpdateHandler(new NXOpen.BlockStyler.BlockDialog.Update(update_cb));
         theDialog.AddFilterHandler(new NXOpen.BlockStyler.BlockDialog.Filter(filter_cb));
         theDialog.AddInitializeHandler(new NXOpen.BlockStyler.BlockDialog.Initialize(initialize_cb));
         theDialog.AddDialogShownHandler(new NXOpen.BlockStyler.BlockDialog.DialogShown(dialogShown_cb));
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         throw ex;
     }
 }
Exemplo n.º 6
0
 private List <NXObject> prtviewFeature = new List <NXObject>(); //预览特征
 //------------------------------------------------------------------------------
 //Constructor for NX Styler class
 //------------------------------------------------------------------------------
 public SuperBox()
 {
     try
     {
         theSession     = Session.GetSession();
         theUFSession   = UFSession.GetUFSession();
         theUI          = NXOpen.UI.GetUI();
         theDlxFileName = "SuperBox.dlx";
         theDialog      = theUI.CreateDialog(theDlxFileName);
         theDialog.AddApplyHandler(new NXOpen.BlockStyler.BlockDialog.Apply(apply_cb));
         theDialog.AddOkHandler(new NXOpen.BlockStyler.BlockDialog.Ok(ok_cb));
         theDialog.AddUpdateHandler(new NXOpen.BlockStyler.BlockDialog.Update(update_cb));
         theDialog.AddFilterHandler(new NXOpen.BlockStyler.BlockDialog.Filter(filter_cb));
         theDialog.AddInitializeHandler(new NXOpen.BlockStyler.BlockDialog.Initialize(initialize_cb));
         theDialog.AddFocusNotifyHandler(new NXOpen.BlockStyler.BlockDialog.FocusNotify(focusNotify_cb));
         theDialog.AddDialogShownHandler(new NXOpen.BlockStyler.BlockDialog.DialogShown(dialogShown_cb));
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         throw ex;
     }
 }
Exemplo n.º 7
0
 static PartEx()
 {
     theSession = NXOpen.Session.GetSession();
     workPart   = theSession.Parts.Work;
     theUI      = UI.GetUI();
 }