Is it possible to use "Schedule Available Fields from:"

Hi All

Is it possible to get “Schedulable Fields” from “Select available Fields from” in schedules using dynamo ?

Regards

Yes. Use ScheduleView.SchedulableFields to list all available fields. It’s included in the Revit package.

1 Like

I had a look at this but only parameters available are from “Multi category” cant see any revit links or other ones ill have a look again.

Thanks

Yeah that node, should give you every schedulable field from all categories in the list that you are referencing, including the RVT Links

image

2 Likes

Hi Thanks for your time again.

Yes i can get like this if its set to this category.

I do require parameters from all 4 category’s and want to switch between them when creating schedule is it possible to select parameters from each category using dynamo ?

I do create Multy category schedule using dynamo and i have 4 categories that hold required parameters for schedule but struggling to find a way to switch between category’s as by default it only give me parameters from “Multi category”.

Regards

I am assuming that you are using Dynamo to add the fields to the schedule. You just filter through the list by the names of the fields and add those fields to the schedule.

Example: list being fed into the List.Flatten node is a list of field names that I want to add to the schedule.

This method is not dependent on which category you have selected as active in your schedule.

2 Likes

Thanks again for your time.

That’s where my problem is these parameters from different categories no available to filter from and i do require to switch some how to see them in dynamo.

This what im trying to achieve but no joy yet

Regards

Yeah you shouldn’t have to switch. If you want to provide your graph and a stripped down version of your model, we can test to help see where the problem lies.

1 Like

Thanks Please see below

This is how schedule is created its non project specific as cant get any further than this at this point

And if you connect “ScheduleView.SchedulableFields” you will see that only "Multi category parameters available.

import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System import Array
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument

schedule = []
names = IN[0]

id = ElementId.InvalidElementId


TransactionManager.Instance.EnsureInTransaction(doc)

for i in names:
	
	newSchedule = ViewSchedule.CreateSchedule(doc,id)
	newSchedule.Name = i
	schedule.append(newSchedule)

TransactionManager.Instance.TransactionTaskDone()


OUT = schedule

regards

Weird. It gave me all fields from all categories that it included in the schedule.

image

1 Like

The results above was using your code. But you can refine your code to as shown below, if you want.

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
schedule = []
names = IN[0]

id = ElementId.InvalidElementId


TransactionManager.Instance.EnsureInTransaction(doc)

for i in names:
	
	newSchedule = ViewSchedule.CreateSchedule(doc,id)
	newSchedule.Name = i
	schedule.append(newSchedule)

TransactionManager.Instance.TransactionTaskDone()

OUT = schedule
1 Like

Hi,

a solution using FieldType property and a dictionary

import clr
import sys
import System
from System import Array
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument

view = UnwrapElement(IN[0])
lst_SchedulableField = view.Definition.GetSchedulableFields()
categoryId_schedule = view.Definition.CategoryId
if categoryId_schedule == ElementId.InvalidElementId:
    category_name = "multi-category"
else:
    cat = Category.GetCategory(doc, categoryId_schedule)
    category_name = cat.Name

dict_field_type = dict(zip(System.Enum.GetValues(ScheduleFieldType), System.Enum.GetNames(ScheduleFieldType)))
#
lst_fieldType_Category = [ScheduleFieldType.ElementType, ScheduleFieldType.Instance, ScheduleFieldType.Count]
#
out_dict = {}

for sch_field in lst_SchedulableField:
    if sch_field.FieldType in lst_fieldType_Category:
        field_TypeName =  category_name
    else:
        field_TypeName =  dict_field_type[sch_field.FieldType]
    if field_TypeName not in out_dict:
        out_dict[field_TypeName] = [sch_field]
    else:
        out_dict[field_TypeName].append(sch_field)

OUT = out_dict
5 Likes

Thanks All got it working

Hi,

I tried the above code. In my project, there are 330 fields under ‘Multiple Categories’, but in dynamo, there are 1258 fields under the same as the result of this code.

Is there any workaround to get those 330 fields exactly?

Hi,

I didn’t find any workaround,

same problem here

Awesome i asked for this 2 years ago and resolved with mix of nodes and pythons but not that great

1 Like