예제 #1
0
        protected override void OnExecute(NameValueMap context)
        {
            try
            {
                var selectedView = AddIn.GetDrawingView("Select an assembly view");

                if (selectedView != null)
                {
                    if (selectedView.ViewType == DrawingViewTypeEnum.kStandardDrawingViewType)
                    {
                        var transaction = AddIn.CreateTransaction(DisplayName);
                        selectedView.AddBaseViewOfParts(drawingDistance: 4);
                        transaction.End();
                    }
                    else
                    {
                        MessageBox.Show(
                            messageBoxText: DisplayName + " can only be used on base views.",
                            caption: DisplayName,
                            button: MessageBoxButton.OK,
                            icon: MessageBoxImage.Information
                            );
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }