/// <summary> /// Adds a Revision to a Sheet /// </summary> /// <param name="Sheet">Dynamo wrapped Sheet element</param> /// <param name="Revision">Dynamo wrapped Revision element</param> /// <returns name="Sheet">Returns the modified sheet.</returns> public static DynaSheet AddRevision(DynaSheet Sheet, DynaRevision Revision) { RevitSheet revitSheet = (RevitSheet)Sheet.InternalElement; RevitRevision revitRevision = (RevitRevision)Revision.InternalElement; RevitDoc document = revitSheet.Document; List <RevitDB.ElementId> revisions = (List <RevitDB.ElementId>)revitSheet.GetAdditionalRevisionIds(); if (!revisions.Contains(revitRevision.Id)) { revisions.Add(revitRevision.Id); } if (document.IsModifiable) { TransactionManager.Instance.EnsureInTransaction(document); revitSheet.SetAdditionalRevisionIds(revisions); TransactionManager.Instance.TransactionTaskDone(); } else { using (Autodesk.Revit.DB.Transaction trans = new Autodesk.Revit.DB.Transaction(document)) { trans.Start("Set Revision on Sheet"); revitSheet.SetAdditionalRevisionIds(revisions); trans.Commit(); } } return(Sheet); }
public static Revision Wrap(Autodesk.Revit.DB.Revision ele, bool isRevitOwned) { return(Revision.FromExisting(ele, isRevitOwned)); }