Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create Revision from existing element
 /// </summary>
 /// <param name="instance"></param>
 /// <param name="isRevitOwned"></param>
 /// <returns></returns>
 internal static Revision FromExisting(Autodesk.Revit.DB.Revision instance, bool isRevitOwned)
 {
     return(new Revision(instance)
     {
         IsRevitOwned = isRevitOwned
     });
 }
Ejemplo n.º 3
0
        public static void GetRevisions(Document Doc)
        {
            IList <ElementId> revIds = Autodesk.Revit.DB.Revision.GetAllRevisionIds(Doc);

            foreach (ElementId e in revIds)
            {
                Autodesk.Revit.DB.Revision rev = Doc.GetElement(e) as Autodesk.Revit.DB.Revision;

                logMsgLn2("SequenceNumber", rev.SequenceNumber);
                logMsgLn2("Revision Id (RevisionNumber)", rev.RevisionNumber);
                logMsgLn2("Alt Id (IssuedBy)", rev.IssuedBy);
                logMsgLn2("Issued", rev.Issued);
                logMsgLn2("Block Title (Description)", rev.Description);
                logMsgLn2("Delta Title (IssuedTo)", rev.IssuedTo);
                logMsgLn2("RevisionDate", rev.RevisionDate);
                logMsgLn2("NumberType", rev.NumberType);
                logMsgLn2("Visibility", rev.Visibility);
            }
        }
Ejemplo n.º 4
0
 public static Revision Wrap(Autodesk.Revit.DB.Revision ele, bool isRevitOwned)
 {
     return(Revision.FromExisting(ele, isRevitOwned));
 }
Ejemplo n.º 5
0
 private void InitElement(Autodesk.Revit.DB.Revision element)
 {
     InternalSetElement(element);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Set the internal Element, ElementId, and UniqueId
 /// </summary>
 private void InternalSetElement(Autodesk.Revit.DB.Revision element)
 {
     InternalRevitElement = element;
     InternalElementId    = element.Id;
     InternalUniqueId     = element.UniqueId;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create from an existing Revit Element
 /// </summary>
 private Revision(Autodesk.Revit.DB.Revision Revision)
 {
     SafeInit(() => InitElement(Revision));
 }