Beispiel #1
0
        public void SurfaceAnalysisDataBySurfacePointAndResults_BadArgs()
        {
            Assert.Throws <ArgumentNullException>(() => SurfaceData.BySurfacePointsAndValues(
                                                      null,
                                                      TestUvs(),
                                                      TestResults()));

            Assert.Throws <ArgumentNullException>(() => SurfaceData.BySurfacePointsAndValues(
                                                      TestSurface(),
                                                      null,
                                                      TestResults()));

            Assert.Throws <ArgumentNullException>(() => SurfaceData.BySurfacePointsAndValues(
                                                      TestSurface(),
                                                      TestUvs(),
                                                      null));

            // Test empty calculation set
            Assert.Throws <ArgumentException>(() => SurfaceData.BySurfacePointsAndValues(
                                                  TestSurface(),
                                                  new List <UV>(),
                                                  TestResults()));

            // Test non matching results sets
            Assert.Throws <ArgumentException>(() => SurfaceData.BySurfacePointsAndValues(
                                                  TestSurface(),
                                                  new [] { UV.ByCoordinates(0, 0) },
                                                  TestResults()));
        }
Beispiel #2
0
        public void ByViewAndFaceAnalysisData_ValidArgs()
        {
            var surface = AnalysisDisplayHelpers.GetFirstSurfaceInInPlaceMass();

            var samplePoints = new[]
            {
                UV.ByCoordinates(0, 0),
                UV.ByCoordinates(0.1, 0.2),
                UV.ByCoordinates(0, 0.1),
            };

            var sampleValues = new[]
            {
                1.0,
                1092,
                -1
            };

            var data = SurfaceData.BySurfacePointsAndValues(surface, samplePoints, sampleValues);

            var doc  = Document.Current;
            var grid = FaceAnalysisDisplay.ByViewAndFaceAnalysisData(doc.ActiveView, data);

            Assert.NotNull(grid);
        }
Beispiel #3
0
 public void SurfaceAnalysisDataBySurfacePointsAndResults_ValuesException()
 {
     //This will raise the exception thrown when the values list passed to BySurfacePointsAndValues method is empty
     Assert.Throws <ArgumentException>(() => SurfaceData.BySurfacePointsAndValues(
                                           TestSurface(),
                                           TestUvs(),
                                           new List <double>()));
 }
Beispiel #4
0
        public void SurfaceAnalysisDataBySurfacePointsAndResults_ValidArgs()
        {
            var sad = SurfaceData.BySurfacePointsAndValues(
                TestSurface(),
                TestUvs(),
                TestResults());

            Assert.NotNull(sad);
            Assert.NotNull(sad.Surface);
            Assert.AreEqual(sad.Values.Count, 3);
        }
        /// <summary>
        /// Show a colored Face Analysis Display in the Revit view.
        /// </summary>
        /// <param name="view">The view into which you want to draw the analysis results.</param>
        /// <param name="surface">The surface which you want to show color.</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>A FaceAnalysisDisplay object.</returns>
        public static FaceAnalysisDisplay ByViewFacePointsAndValues(
            View view, Surface surface,
            Autodesk.DesignScript.Geometry.UV[] sampleLocations, double[] samples, string name = "", string description = "", Type unitType = null)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }

            if (sampleLocations == null)
            {
                throw new ArgumentNullException("sampleUvPoints");
            }

            if (samples == null)
            {
                throw new ArgumentNullException("samples");
            }

            if (sampleLocations.Length != samples.Length)
            {
                throw new Exception(Properties.Resources.Array_Count_Mismatch);
            }

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

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

            var data = SurfaceData.BySurfacePointsAndValues(surface, sampleLocations, samples);

            return(new FaceAnalysisDisplay(view.InternalView, data, name, description, unitType));
        }
Beispiel #6
0
        public void ByViewAndFaceAnalysisData_BadArgs()
        {
            var surface = AnalysisDisplayHelpers.GetFirstSurfaceInInPlaceMass();

            var samplePoints = new[]
            {
                UV.ByCoordinates(0, 0),
                UV.ByCoordinates(0.5, 0),
                UV.ByCoordinates(0, 0.5)
            };

            var sampleValues = new[]
            {
                1.0,
                1092,
                -1
            };

            var data = SurfaceData.BySurfacePointsAndValues(surface, samplePoints, sampleValues);
            var doc  = Document.Current;

            Assert.Throws(typeof(System.ArgumentNullException), () => FaceAnalysisDisplay.ByViewAndFaceAnalysisData(null, data));
            Assert.Throws(typeof(System.ArgumentNullException), () => FaceAnalysisDisplay.ByViewAndFaceAnalysisData(doc.ActiveView, null));
        }