private void OnPageClosing(swPropertyManagerPageCloseReasons_e reason, SwEx.PMPage.Base.ClosingArg arg)
        {
            if (reason == swPropertyManagerPageCloseReasons_e.swPropertyManagerPageClose_Okay)
            {
                IBody2 body = null;

                Exception err = null;

                try
                {
                    var cylParams = m_Model.GetCylinderParameters(m_CurrentPart, m_CurrentParameters.Direction,
                                                                  m_CurrentParameters.ConcenticWithCylindricalFace,
                                                                  m_CurrentParameters.StockStep, m_CurrentParameters.ExtraRadius);

                    body = m_Model.CreateCylindricalStock(cylParams);
                }
                catch (Exception ex)
                {
                    err = ex;
                }

                if (body == null)
                {
                    arg.Cancel       = true;
                    arg.ErrorTitle   = "Cylindrical Stock Error";
                    arg.ErrorMessage = err?.Message;
                }
            }
        }
        private void OnPageApplying(ISldWorks app, IModelDoc2 model, TPage data, SwEx.PMPage.Base.ClosingArg arg)
        {
            if (m_LastError != null)
            {
                Logger.Log(m_LastError);

                arg.Cancel     = true;
                arg.ErrorTitle = Resources.MacroFeatureErrorInvalidParameters;

                if (m_LastError is UserErrorException)
                {
                    arg.ErrorMessage = m_LastError.Message;
                }
                else
                {
                    arg.ErrorMessage = "Unknown error";
                }
            }
        }
示例#3
0
 private void ValidateReference(IEntity reference, swPropertyManagerPageCloseReasons_e reason, SwEx.PMPage.Base.ClosingArg arg)
 {
     if (reason == swPropertyManagerPageCloseReasons_e.swPropertyManagerPageClose_Okay)
     {
         if (reference == null)
         {
             arg.ErrorMessage = "Select reference";
             arg.Cancel       = true;
         }
     }
 }
示例#4
0
 private void OnCylPageClosing(swPropertyManagerPageCloseReasons_e reason, SwEx.PMPage.Base.ClosingArg arg)
 {
     ValidateReference(m_CurCylData.Reference, reason, arg);
 }