public void VectorAnalysisDataByPointsAndResults_BadArgs() { Assert.Throws <ArgumentNullException>( () => VectorAnalysisData.ByPointsAndResults( null, TestResultNames(), TestVectorResults())); Assert.Throws <ArgumentNullException>( () => VectorAnalysisData.ByPointsAndResults( TestPoints(), null, TestVectorResults())); Assert.Throws <ArgumentNullException>( () => VectorAnalysisData.ByPointsAndResults( TestPoints(), TestResultNames(), null)); Assert.Throws <ArgumentException>( () => VectorAnalysisData.ByPointsAndResults( TestPoints(), new [] { "cat", "foo" }, TestVectorResults())); }
public void ByViewAndVectorAnalysisData_BadArgs() { var samplePoints = new[] { Point.ByCoordinates(0, 2, 4), Point.ByCoordinates(0, 7, 4), Point.ByCoordinates(0, 19, 4) }; var sampleValues = new[] { Vector.ByCoordinates(0, 2, 4), Vector.ByCoordinates(0, 7, 4), Vector.ByCoordinates(0, 19, 4) }; var data = VectorAnalysisData.ByPointsAndResults( samplePoints, new List <string>() { "Test vector data." }, new List <IList <Vector> >() { sampleValues }); var doc = Document.Current; Assert.Throws(typeof(System.ArgumentNullException), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(null, new [] { data })); Assert.Throws(typeof(System.ArgumentNullException), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, null)); Assert.Throws(typeof(System.Exception), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, new VectorAnalysisData[] {})); }
public void ByViewAndVectorAnalysisData_ValidArgs() { var samplePoints = new[] { Point.ByCoordinates(0, 2, 4), Point.ByCoordinates(0, 7, 4), Point.ByCoordinates(0, 19, 4) }; var sampleValues = new[] { Vector.ByCoordinates(0, 2, 4), Vector.ByCoordinates(0, 7, 4), Vector.ByCoordinates(0, 19, 4) }; var data = VectorAnalysisData.ByPointsAndResults( samplePoints, new List <string>() { "Test vector data." }, new List <IList <Vector> >() { sampleValues }); var doc = Document.Current; var grid = VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, new [] { data }); Assert.NotNull(grid); }
public void VectorAnalysisDataByPointsAndResults_ValidArgs() { var vad = VectorAnalysisData.ByPointsAndResults(TestPoints(), TestResultNames(), TestVectorResults()); Assert.NotNull(vad); Assert.NotNull(vad.CalculationLocations); Assert.NotNull(vad.Results); Assert.AreEqual(vad.Results.Count, 3); }
/// <summary> /// Show a Vector Analysis Display in the Revit view. /// </summary> /// <param name="view">The view into which you want to draw the analysis results.</param> /// <param name="samplePoints">The locations at which you want to create analysis values.</param> /// <param name="samples">The analysis values at the given locations.</param> /// <param name="name">An optional analysis results name to show on the results legend.</param> /// <param name="description">An optional analysis results description to show on the results legend.</param> /// <param name="unitType">An optional Unit type to provide conversions in the analysis results.</param> /// <returns>A VectorAnalysisDisplay object.</returns> public static VectorAnalysisDisplay ByViewPointsAndVectorValues(View view, Autodesk.DesignScript.Geometry.Point[] sampleLocations, Vector[] samples, string name = "", string description = "", Type unitType = null) { if (view == null) { throw new ArgumentNullException("view"); } if (sampleLocations == null) { throw new ArgumentNullException("samplePoints"); } if (samples == null) { throw new ArgumentNullException("samples"); } if (sampleLocations.Length != samples.Length) { throw new Exception("The number of sample points and number of samples must be the same"); } if (string.IsNullOrEmpty(name)) { name = Resource1.AnalysisResultsDefaultName; } if (string.IsNullOrEmpty(description)) { description = Resource1.AnalysisResultsDefaultDescription; } var data = VectorAnalysisData.ByPointsAndResults(sampleLocations, new List <string> { "Dynamo Data" }, new List <IList <Vector> > { samples }); return(new VectorAnalysisDisplay(view.InternalView, new List <VectorAnalysisData>() { data }, name, description, unitType)); }