Пример #1
0
        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 = PointData.ByPointsAndValues(
                samplePoints,
                sampleValues);

            var doc = Document.Current;

            Assert.Throws(typeof(System.ArgumentNullException), () => PointAnalysisDisplay.ByViewAndPointAnalysisData(null, data));
            Assert.Throws(typeof(System.ArgumentNullException), () => PointAnalysisDisplay.ByViewAndPointAnalysisData(doc.ActiveView, null));
        }
Пример #2
0
        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 = PointData.ByPointsAndValues(
                samplePoints,
                sampleValues);

            var doc  = Document.Current;
            var grid = PointAnalysisDisplay.ByViewAndPointAnalysisData(doc.ActiveView, data);

            Assert.NotNull(grid);
        }
Пример #3
0
        public void PointAnalysisDataByPointsAndResults_BadArgs()
        {
            Assert.Throws <ArgumentNullException>(
                () => PointData.ByPointsAndValues(null, TestResults()));

            Assert.Throws <ArgumentNullException>(
                () => PointData.ByPointsAndValues(TestPoints(), null));

            Assert.Throws <ArgumentException>(
                () => PointData.ByPointsAndValues(new [] { Point.ByCoordinates(0, 0) }, TestResults()));
        }
Пример #4
0
        public void PointAnalysisDataByPointsAndResults_ValidArgs()
        {
            var pad = PointData.ByPointsAndValues(
                TestPoints(),
                TestResults());

            Assert.NotNull(pad);
            Assert.NotNull(pad.ValueLocations);
            Assert.NotNull(pad.Values);
            Assert.AreEqual(pad.Values.Count, 3);
        }
Пример #5
0
        /// <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 = Properties.Resources.AnalysisResultsDefaultName;
            }

            if (string.IsNullOrEmpty(description))
            {
                description = Properties.Resources.AnalysisResultsDefaultDescription;
            }

            var data = PointData.ByPointsAndValues(sampleLocations, samples);

            return(new PointAnalysisDisplay(view.InternalView, data, name, description, unitType));
        }