public void ByViewAndPointAnalysisData_BadArgs() { var samplePoints = new[] { Point.ByCoordinates(0, 2, 4), Point.ByCoordinates(0, 7, 4), Point.ByCoordinates(0, 19, 4) }; var sampleValues = new[] { 1.0, 1092, -1 }; var data = PointAnalysisData.ByPointsAndResults( samplePoints, new List <string>() { "Test points." }, new IList <double>[] { sampleValues }); var doc = Document.Current; Assert.Throws(typeof(System.ArgumentNullException), () => PointAnalysisDisplay.ByViewAndPointAnalysisData(null, new [] { data })); Assert.Throws(typeof(System.ArgumentNullException), () => PointAnalysisDisplay.ByViewAndPointAnalysisData(doc.ActiveView, null)); Assert.Throws(typeof(System.Exception), () => PointAnalysisDisplay.ByViewAndPointAnalysisData(doc.ActiveView, new PointAnalysisData[] { })); }
public void ByViewAndPointAnalysisData_ValidArgs() { var samplePoints = new[] { Point.ByCoordinates(0, 2, 4), Point.ByCoordinates(0, 7, 4), Point.ByCoordinates(0, 19, 4) }; var sampleValues = new[] { 1.0, 1092, -1 }; var data = PointAnalysisData.ByPointsAndResults( samplePoints, new List <string>() { "Test points." }, new IList <double>[] { sampleValues }); var doc = Document.Current; var grid = PointAnalysisDisplay.ByViewAndPointAnalysisData(doc.ActiveView, new [] { data }); Assert.NotNull(grid); }
public void PointAnalysisDataByPointsAndResults_ValidArgs() { var pad = PointAnalysisData.ByPointsAndResults( TestPoints(), TestResultNames(), TestResults()); Assert.NotNull(pad); Assert.NotNull(pad.CalculationLocations); Assert.NotNull(pad.Results); Assert.AreEqual(pad.Results.Count, 3); }
public void PointAnalysisDataByPointsAndResults_BadArgs() { Assert.Throws <ArgumentNullException>( () => PointAnalysisData.ByPointsAndResults(null, TestResultNames(), TestResults())); Assert.Throws <ArgumentNullException>( () => PointAnalysisData.ByPointsAndResults(TestPoints(), null, TestResults())); Assert.Throws <ArgumentNullException>( () => PointAnalysisData.ByPointsAndResults(TestPoints(), TestResultNames(), null)); Assert.Throws <ArgumentException>( () => PointAnalysisData.ByPointsAndResults(TestPoints(), new [] { "cat", "foo" }, TestResults())); }
/// <summary> /// Show a colored Point Analysis Display in the Revit view. /// </summary> /// <param name="view">The view into which you want to draw the analysis results.</param> /// <param name="sampleLocations">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>An PointAnalysisDisplay object.</returns> public static PointAnalysisDisplay ByViewPointsAndValues(View view, Autodesk.DesignScript.Geometry.Point[] sampleLocations, double[] 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 = PointAnalysisData.ByPointsAndResults(sampleLocations, new List <string> { "Dynamo Data" }, new List <IList <double> > { samples }); return(new PointAnalysisDisplay(view.InternalView, new List <PointAnalysisData> { data }, name, description, unitType)); }