/// <summary> /// Initialize a ScheduleOnSheet element /// </summary> /// <param name="sheet"></param> /// <param name="scheduleView"></param> /// <param name="location"></param> private void InitScheduleOnSheet(Sheet sheet, Revit.Elements.Views.ScheduleView scheduleView, Autodesk.DesignScript.Geometry.Point location) { ElementId sheetId = sheet.InternalView.Id; ElementId scheduleViewId = scheduleView.InternalView.Id; XYZ scheduleLocation = GeometryPrimitiveConverter.ToRevitType(location); TransactionManager.Instance.EnsureInTransaction(Document); var scheduleOnSheetElement = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.ScheduleSheetInstance>(Document); scheduleOnSheetElement = Autodesk.Revit.DB.ScheduleSheetInstance.Create(Document, sheetId, scheduleViewId, scheduleLocation); InternalSetScheduleOnSheet(scheduleOnSheetElement); TransactionManager.Instance.TransactionTaskDone(); ElementBinder.CleanupAndSetElementForTrace(Document, this.InternalElement); }
/// <summary> /// Creates a new ScheduleOnSheet at a given location on a sheet. /// </summary> /// <param name="sheet">The Sheet on which the new ScheduleOnSheet will be placed.</param> /// <param name="scheduleView">The scheduleView shown in the ScheduleOnSheet.</param> /// <param name="location">The new ScheduleOnSheet will be centered on this point.</param> /// <returns>The new ScheduleOnSheet</returns> public static ScheduleOnSheet BySheetScheduleLocation(Sheet sheet, Revit.Elements.Views.ScheduleView scheduleView, Autodesk.DesignScript.Geometry.Point location) { if (sheet == null) { throw new ArgumentNullException("sheet"); } if (scheduleView == null) { throw new ArgumentNullException("scheduleView"); } if (location == null) { throw new ArgumentNullException("location"); } if (IsScheduleEmpty(scheduleView.InternalViewSchedule)) { throw new InvalidOperationException(Properties.Resources.EmptySchedule); } return(new ScheduleOnSheet(sheet, scheduleView, location)); }
/// <summary> /// Create a new ScheduleOnSheet by sheet, scheduleView and location /// </summary> /// <param name="sheet"></param> /// <param name="scheduleView"></param> /// <param name="location"></param> private ScheduleOnSheet(Sheet sheet, Revit.Elements.Views.ScheduleView scheduleView, Autodesk.DesignScript.Geometry.Point location) { SafeInit(() => InitScheduleOnSheet(sheet, scheduleView, location)); }