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); } }
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)); }
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); }
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); }
public void ByElement_ValidArgs() { var line = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(1000, 0, 0)); Assert.NotNull(line); Autodesk.Revit.DB.FilteredElementCollector collector = new Autodesk.Revit.DB.FilteredElementCollector(Revit.Application.Document.Current.InternalDocument).OfClass(typeof(Autodesk.Revit.DB.WallType)); Revit.Elements.WallType wt = Revit.Elements.WallType.FromExisting((Autodesk.Revit.DB.WallType)collector.FirstOrDefault(), true); var wall = Wall.ByCurveAndHeight(line, 300, Level.ByElevation(100), wt); Assert.NotNull(wall); var tag = Tag.ByElement(Revit.Application.Document.Current.ActiveView, wall, true, false, "Center", "Middle", Vector.ByCoordinates(0, 0, 0)); Assert.NotNull(tag); }
public void ByElementAndOffset_ValidArgs() { var line = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(1000, 0, 0)); Assert.NotNull(line); Autodesk.Revit.DB.FilteredElementCollector collector = new Autodesk.Revit.DB.FilteredElementCollector(Revit.Application.Document.Current.InternalDocument).OfClass(typeof(Autodesk.Revit.DB.WallType)); Revit.Elements.WallType wt = Revit.Elements.WallType.FromExisting((Autodesk.Revit.DB.WallType)collector.FirstOrDefault(), true); var wall = Wall.ByCurveAndHeight(line, 300, Level.ByElevation(100), wt); Assert.NotNull(wall); var tag = Tag.ByElementAndOffset(Revit.Application.Document.Current.ActiveView, wall, Vector.ByCoordinates(0, 0, 0)); Assert.NotNull(tag); Assert.NotNull(tag.InternalElement); Assert.IsInstanceOf(typeof(Autodesk.Revit.DB.IndependentTag), tag.InternalElement); var itag = tag.InternalElement as Autodesk.Revit.DB.IndependentTag; itag.TagHeadPosition.DistanceTo(new Autodesk.Revit.DB.XYZ(500, 0, 0)).ShouldBeApproximately(0); }