예제 #1
0
        public void BySheetScheduleLocation()
        {
            var sheet = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument)
                        .OfClass(typeof(ViewSheet))
                        .Where(x => x.Name.Equals("Unnamed"))
                        .First() as ViewSheet;
            var scheduleView = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument)
                               .OfClass(typeof(Autodesk.Revit.DB.ViewSchedule))
                               .Where(x => x.Name.Equals("View List"))
                               .First() as ViewSchedule;
            var location = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0);

            var scheduleOnSheet = ScheduleOnSheet.BySheetScheduleLocation(Sheet.FromExisting(sheet, true), ScheduleView.FromExisting(scheduleView, true), location);

            Assert.AreEqual("View List", scheduleOnSheet.Name);
        }
예제 #2
0
        public void BySheetScheduleLocation_EmptySchedule()
        {
            var sheet = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument)
                        .OfClass(typeof(ViewSheet))
                        .Where(x => x.Name.Equals("Unnamed"))
                        .First() as ViewSheet;
            var scheduleView = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument)
                               .OfClass(typeof(Autodesk.Revit.DB.ViewSchedule))
                               .Where(x => x.Name.Equals("Room Schedule"))
                               .First() as ViewSchedule;
            var location = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0);

            var expectedExceptionMessage = Revit.Properties.Resources.EmptySchedule;

            var exceptionScheduleOnSheet = Assert.Throws <InvalidOperationException>(() => ScheduleOnSheet.BySheetScheduleLocation(Sheet.FromExisting(sheet, true), ScheduleView.FromExisting(scheduleView, true), location));


            Assert.AreEqual(expectedExceptionMessage, exceptionScheduleOnSheet.Message);
        }