Hello Everyone,
So I am new to programming and still trying to wrap my head around loops vs non loops. How to make them vs not make them. I have the following code that accepts 1 Document but want to get used to formatting them in a fashion that I can understand when a Loop is needed (For multiple) vs just accepting 1. Thank you for any help or guidance!
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#Preparing input from dynamo to revit
linkDoc = UnwrapElement(IN[0])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
LinkSheets = FilteredElementCollector(linkDoc).OfCategory(BuiltInCategory.OST_Sheets).ToElements()
sheetRevs = []
revName = []
for sheet in LinkSheets:
revs = sheet.GetAllRevisionIds()
for r in revs:
rev = linkDoc.GetElement(r)
sheetRevs.Add(rev)
revName.Add(rev.Name)
TransactionManager.Instance.TransactionTaskDone()
OUT = sheetRevs,revName
P.S. Feel free to use this if you are trying to get revisions from a linked file!