Schedule Field ToDSType()

Hi all,

This doesn’t work, I’m not sure why…

#thanks All!

import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
from Revit.Elements import *

clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.GeometryReferences)

schedule = UnwrapElement(IN[0])

fields = []
Output = []


definit = schedule.Definition
countParameters = definit.GetFieldCount() 


for i in range(countParameters):
    field = definit.GetField(i)
    if field.IsHidden == False:
#	    Output.append(field)
	    Output.append(field.ToDSType(true))

OUT = Output

I can get all the Schedule Fields

image

but not as Dynamo types?
image

Any thoughts would be appreciated,

Thanks,

Mark

Seems related to this,

TLDR: The Dynamo team has not given us “wrappers” for every Autodesk.Revit.DB element.

2 Likes

ScheduleField is a pure Revit API object as it doesn’t inherit from the Element base class and ToDSType() can only be called on Revit elements which inherit from this base class (a ‘top-level’ object)!

image

2 Likes

Thanks guys!

It’s no biggy for what I’m doing now, it only confused me because there is an OOTB node which returns the fields (as Dynamo objects?)
image
I had a rummage around to look at the code (here I think? https://github.com/DynamoDS/DynamoRevit/blob/master/src/Libraries/RevitNodes/Elements/Views/ScheduleView.cs) but I couldn’t work it out.

Cheers,

Mark

Sure, but its not a wrapper class, so you cant for example, extract the InternalElement (which is a property to access the Revit API object from the wrapper).

It looks like Dynamo simply uses the name of the field (stored in this object type) to query and obtain the Revit API ScheduleField as there’s no connection between this class and Revit’s one.

1 Like

How is possible to edit the schedule field name from Dynamo as we can do it manually typing in the schedule editor?