コード例 #1
0
ファイル: Sheet.cs プロジェクト: andradam75/Synthetic
        /// <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);
        }
コード例 #2
0
 public static Revision Wrap(Autodesk.Revit.DB.Revision ele, bool isRevitOwned)
 {
     return(Revision.FromExisting(ele, isRevitOwned));
 }