The only thing I can Imagine is that somewhere the lists went corrupt by being thrown from project to project … +2000
The amount of project parameters available on this particular document is imense though …
Someone please help me. I’m new and try to use as much standard nodes as possible to get going.
FieldId does not relate to index or column position. It’s just an identifier based on how many parameters have been added to the schedule. In fact, if you add Param1 and Param2 to your schedule as Ids 0 and 1, if you removed and re-added Param2, it would actually get a new Id of 3.
Ok. So the message will be to dig into the API and fetch some usefull parameters compared to thos guy. Can i collect the code behind a standard node to start from here?
FieldId does not relate to index or column position. It’s just an identifier based on how many parameters have been added to the schedule. In fact, if you add Param1 and Param2 to your schedule as Ids 0 and 1, if you removed and re-added Param2, it would actually get a new Id of 3.
Not really sure why, but I was not able to get the DB element from the Fields Node and therefore none of the Methods or properties I tried to get after was working. @solamour
I ended up doing all of it in python to get the Name, Field Id, and Field Index for the values in a schedule. With these things you should be able to get the relationship you are after.
using the internal property ‘InternalScheduleField’ of ‘Revit.Schedules.ScheduleField’ to get DB.ScheduleField object with Reflection, then using GetName() It’s not ideal, but it’s a solution
#Preparing input from dynamo to revit
items = UnwrapElement(IN[0])
element = UnwrapElement(items)
#Do some action in a Transaction
output = []
for element in items:
TransactionManager.Instance.EnsureInTransaction(doc)
order = element.Definition.GetFieldOrder()
fields = [element.Definition.GetField(o) for o in order]
TransactionManager.Instance.TransactionTaskDone()
output.append([f.FieldId for f in fields])
OUT = output
#Sean Page
#https://www.linkedin.com/in/sean-page-aia-ncarb-leed-ap-b06b0041/
#2021
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
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
schedules = UnwrapElement(IN[0])
fieldIds = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for schedule in schedules:
order = schedule.Definition.GetFieldOrder()
fields = [schedule.Definition.GetField(o) for o in order]
fieldIds.append([f.FieldId for f in fields])
TransactionManager.Instance.TransactionTaskDone()
OUT = fieldIds