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 = VectorData.ByPointsAndValues(
                samplePoints,
                sampleValues);

            var doc = Document.Current;

            Assert.Throws(typeof(System.ArgumentNullException), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(null, data));
            Assert.Throws(typeof(System.ArgumentNullException), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, null));
        }
        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 = VectorData.ByPointsAndValues(
                samplePoints,
                sampleValues);

            var doc  = Document.Current;
            var grid = VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, data);

            Assert.NotNull(grid);
        }
示例#3
0
        public void VectorAnalysisDataByPointsAndResults_ValidArgs()
        {
            var vad = VectorData.ByPointsAndValues(TestPoints(), TestVectorResults());

            Assert.NotNull(vad);
            Assert.NotNull(vad.ValueLocations);
            Assert.NotNull(vad.Values);
            Assert.AreEqual(vad.Values.Count, 3);
        }
示例#4
0
        public void VectorAnalysisDataByPointsAndResults_BadArgs()
        {
            Assert.Throws <ArgumentNullException>(
                () =>
                VectorData.ByPointsAndValues(
                    null,
                    TestVectorResults()));

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

            Assert.Throws <ArgumentException>(
                () =>
                VectorData.ByPointsAndValues(
                    new [] { Point.ByCoordinates(0, 0) },
                    TestVectorResults()));
        }
示例#5
0
        /// <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(Properties.Resources.SamplePointsMismatchError);
            }

            if (string.IsNullOrEmpty(name))
            {
                name = Properties.Resources.AnalysisResultsDefaultName;
            }

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

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

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