示例#1
0
        public void CheckBoundaryAndLocationProperty()
        {
            var level    = Level.ByElevation(0);
            var wallType = WallType.ByName("Generic - 8\"");

            var line1 = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(0, 1000, 0));
            var line2 = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 1000, 0), Point.ByCoordinates(1000, 1000, 0));
            var line3 = Line.ByStartPointEndPoint(Point.ByCoordinates(1000, 1000, 0), Point.ByCoordinates(1000, 0, 0));
            var line4 = Line.ByStartPointEndPoint(Point.ByCoordinates(1000, 0, 0), Point.ByCoordinates(0, 0, 0));
            var wall1 = Wall.ByCurveAndHeight(line1, 500, level, wallType);
            var wall2 = Wall.ByCurveAndHeight(line2, 500, level, wallType);
            var wall3 = Wall.ByCurveAndHeight(line3, 500, level, wallType);
            var wall4 = Wall.ByCurveAndHeight(line4, 500, level, wallType);

            Point pt = Point.ByCoordinates(500, 500, 0);

            // Create a new room
            var room = Revit.Elements.Room.ByLocation(level, pt, "myRoom", "myNumber");

            Assert.NotNull(room);

            Assert.IsTrue(room.Location.DistanceTo(pt) < 0.001);

            var curves = room.CenterBoundary;

            Assert.IsNotNull(curves);
            Assert.IsTrue(curves.First().Count() == 4);

            double length = curves.First().First().Length;

            foreach (var curve in curves.First())
            {
                length.ShouldBeApproximately(curve.Length);
            }
        }
示例#2
0
        public void ByName_ValidArgs()
        {
            var wallTypeName = "Curtain Wall 1";
            var wallType     = WallType.ByName(wallTypeName);

            Assert.NotNull(wallType);
            Assert.AreEqual(wallTypeName, wallType.Name);
        }
示例#3
0
        public void ByFace_ShouldCreateFaceWall()
        {
            Element  elem     = ElementSelector.ByElementId(205302);
            var      refr     = elem.ElementFaceReferences[0].InternalReference;
            var      wallType = WallType.ByName("Generic - 5\"");
            FaceWall wall     = FaceWall.ByFace(Autodesk.Revit.DB.WallLocationLine.CoreCenterline, wallType, refr);

            Assert.NotNull(wall);
            Assert.AreEqual(wall.GetType(), typeof(FaceWall));
            Assert.NotNull(wall.InternalElement);
        }
示例#4
0
        public void ByCurveAndHeight_NullArgs()
        {
            var elevation = 0;
            var level     = Level.ByElevation(elevation);
            var line      = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(10, 10, 0));
            var wallType  = WallType.ByName("Curtain Wall 1");

            Assert.Throws(typeof(ArgumentNullException), () => Wall.ByCurveAndHeight(null, 10, level, wallType));
            Assert.Throws(typeof(ArgumentNullException), () => Wall.ByCurveAndHeight(line, 10, null, wallType));
            Assert.Throws(typeof(ArgumentNullException), () => Wall.ByCurveAndHeight(line, 10, level, null));
        }
示例#5
0
        public void ByCurveAndHeight_ValidArgs()
        {
            var elevation = 0;
            var level     = Level.ByElevation(elevation);
            var line      = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(10, 10, 0));
            var wallType  = WallType.ByName("Curtain Wall 1");

            var wall = Wall.ByCurveAndHeight(line, 10, level, wallType);

            Assert.NotNull(wall);
        }
示例#6
0
        public void ByCurveAndLevels_ShouldCreateGeometricallyCorrectWall()
        {
            var elevation = 100;
            var line      = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 100), Point.ByCoordinates(10, 10, 100));
            var level0    = Level.ByElevation(elevation);
            var level1    = Level.ByElevation(elevation + 100);
            var wallType  = WallType.ByName("Curtain Wall 1");

            var wall = Wall.ByCurveAndLevels(line, level0, level1, wallType);

            wall.BoundingBox.MinPoint.Z.ShouldBeApproximately(elevation);
        }
示例#7
0
        public void ByCurveAndHeight_ShouldCreateGeometricallyCorrectWall()
        {
            var elevation = 5;
            var level     = Level.ByElevation(elevation);
            var line      = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(10, 10, 0));
            var wallType  = WallType.ByName("Curtain Wall 1");

            var wall = Wall.ByCurveAndHeight(line, 10, level, wallType);

            var bb = wall.BoundingBox.MinPoint;

            bb.Z.ShouldBeApproximately(elevation);
        }
示例#8
0
        public void ByCurveAndLevels_ValidArgs()
        {
            // prevent rebinding when creating levels
            ElementBinder.IsEnabled = false;

            var elevation = 100;
            var line      = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 100), Point.ByCoordinates(10, 10, 100));
            var level0    = Level.ByElevation(elevation);
            var level1    = Level.ByElevation(elevation + 100);
            var wallType  = WallType.ByName("Curtain Wall 1");

            var wall = Wall.ByCurveAndLevels(line, level0, level1, wallType);

            Assert.NotNull(wall);
        }
示例#9
0
 public void ByName_NullArgument()
 {
     Assert.Throws(typeof(ArgumentNullException), () => WallType.ByName(null));
 }