Exemple #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());
            }
        }
        override protected void OnExecute(NameValueMap context)
        {
            var transaction = AddIn.CreateTransaction(DisplayName);

            try
            {
                // TODO Add extension method that finds a row based on part number.
                //var partsLists = DrawingDocument.ActiveSheet.PartsLists;

                foreach (var drawingView in AddIn.GetDrawingViews("Select a view"))
                {
                    drawingView.AddTopAndLeftProjectedViews(addDimensions: true, drawingDistance: 0.5);
                    AddPartNameNote(drawingView);
                }

                transaction.End();
            }
            catch (Exception ex)
            {
                transaction.Abort();
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #3
0
        protected override void OnExecute(NameValueMap context)
        {
            var transaction = AddIn.CreateTransaction(DisplayName);

            try
            {
                foreach (var drawingView in AddIn.GetDrawingViews("Select a view"))
                {
                    drawingView.AddLeftThenTopProjectedViews(
                        numberOfTopViews: 3,
                        addDimensions: true,
                        drawingDistance: 2.5
                        );
                }

                transaction.End();
            }
            catch (Exception ex)
            {
                transaction.Abort();
                MessageBox.Show(ex.ToString());
            }
        }