Get Schedulable fields - Python

python

#1

Hi community,
Im learning basic python myself and of course with the help of dynamo community. I managed to get some of those work except for this one, i know that theres a node now to get similar result, just an additional
information on how things works.

btw, looking at Revit API Schedulable Fields my thought is possible, so here’s what i did but it’s not working.

Thanks.

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

schedule = UnwrapElement(IN[0])
definition = schedule.Definition
ids = definition.GetFieldOrder()
fieldnames = []

def getFields(schedule):
	definition = schedule.Definition

for id in ids:
	param = definition.SchedulableField(id)
	fieldnames.append(param.GetName())

#Assign your output to the OUT variable.
OUT = fieldnames

#2

@interactiverendering
You are allmost done it) :slightly_smiling_face:
just add library and use coorectly your def

import clr

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

schedule = UnwrapElement(IN[0])
definition = schedule.Definition
ids = definition.GetFieldOrder()
fieldnames = []

def getFields(schedule):
	definition = schedule.Definition

for id in ids:
	param = definition.GetField(id)
	fieldnames.append(param.GetName())


OUT = fieldnames