/// <summary> /// Adds a projected view to the top and left of the current <see cref="DrawingView"/> instance. /// </summary> /// <param name="drawingView"> /// The <see cref="DrawingView"/> instance that this extension method affects. /// </param> /// <param name="addDimensions"> /// A value that specifies whether dimensions need to be added. /// </param> /// <param name="drawingDistance"> /// The distance between <paramref name="drawingView"/> and the projected views. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="drawingView"/> is <c>null</c>. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="drawingDistance"/> is negative. /// </exception> public static void AddTopAndLeftProjectedViews( this DrawingView drawingView, bool addDimensions, double drawingDistance ) { if (drawingView == null) { throw new ArgumentNullException(nameof(drawingView)); } if (drawingDistance < 0) { throw new ArgumentOutOfRangeException(nameof(drawingDistance)); } var topProjectedView = drawingView.AddTopProjectedView(drawingDistance); var leftProjectedView = drawingView.AddLeftProjectedView(drawingDistance); if (addDimensions) { var dimensionStyle = DrawingDocument.ActiveLinearDimensionStyle(); topProjectedView.AddHorizontalDimension(dimensionStyle); leftProjectedView.AddVerticalDimension(dimensionStyle); } }
/// <summary> /// Adds a left projected view of the current <see cref="DrawingView"/> instance, and then a /// specified number of top projected views, each time using the previously generated /// <see cref="DrawingView"/> instance as a base. /// </summary> /// <param name="drawingView"> /// The <see cref="DrawingView"/> instance that this extension method affects. /// </param> /// <param name="numberOfTopViews"> /// The number of top projected views to add. /// </param> /// <param name="addDimensions"> /// A value that specifies whether dimensions need to be added. /// </param> /// <param name="drawingDistance"> /// The distance between <paramref name="drawingView"/> and each subsequent projected view. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="drawingView"/> is <c>null</c>. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="numberOfTopViews"/> or <paramref name="drawingDistance"/> is negative. /// </exception> public static void AddLeftThenTopProjectedViews( this DrawingView drawingView, int numberOfTopViews, bool addDimensions, double drawingDistance ) { if (drawingView == null) { throw new ArgumentNullException(nameof(drawingView)); } if (numberOfTopViews < 0) { throw new ArgumentOutOfRangeException(nameof(numberOfTopViews)); } if (drawingDistance < 0) { throw new ArgumentOutOfRangeException(nameof(drawingDistance)); } var leftProjectedView = drawingView.AddLeftProjectedView(drawingDistance); var topProjectedViews = new List <DrawingView>(); var previousProjectedView = leftProjectedView; for (int i = 0; i < numberOfTopViews; i++) { var topProjectedView = previousProjectedView.AddTopProjectedView(drawingDistance); topProjectedViews.Add(topProjectedView); previousProjectedView = topProjectedView; } if (addDimensions) { var dimensionStyle = DrawingDocument.ActiveLinearDimensionStyle(); leftProjectedView.AddHorizontalDimension(dimensionStyle); topProjectedViews.ForEach(x => x.AddHorizontalDimension(dimensionStyle)); } }