These colour schemes are the category “Rooms”
But I don’t seem to be able to find that parameter in Dynamo:
Can’t do this either…
Basically I’m trying to filter by “Rooms”.
These colour schemes are the category “Rooms”
But I don’t seem to be able to find that parameter in Dynamo:
Can’t do this either…
Basically I’m trying to filter by “Rooms”.
the issue is you are looking for KeySchedule.Parameters
#📦 Variables
p_key_name = 'Room Style' # Write Your Key-Param Name!
key_schedule = None
#1️⃣ Get all Schedules
all_schedules = FilteredElementCollector(doc)\
.OfCategory(BuiltInCategory.OST_Schedules)\
.ToElements()
#2️⃣ Get Key-Schedule
for schedule in all_schedules:
try:
if schedule.KeyScheduleParameterName == p_key_name:
key_schedule = schedule
break
except:
pass
#💡 Ensure you found matching schedule
if not key_schedule:
forms.alert("Can't find matching Schedule.\nPlease Try Again.",
exitscript=True)
#3️⃣ Get Possible Key-Parameter Values
key_values = FilteredElementCollector(doc, key_schedule.Id).ToElements()
dict_key_values = {key.Name : key.Id for key in key_values}
#👀 Display Key-Parameter Values {Names: Id}
print('Key Parameter: {}'.format(p_key_name))
print('Matching Schedule: {}'.format(key_schedule.Name))
for k,v in dict_key_values.items():
print(k,v)
this is a pyRevit Script. I think you can modify it. KeyScheduleParameterName Property
i was too courious!
it works look
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
#1️⃣ Get all Schedules
all_schedules = FilteredElementCollector(doc)\
.OfCategory(BuiltInCategory.OST_Schedules)\
.ToElements()
p_key_name = "RoomStyle"
#2️⃣ Get Key-Schedule
for schedule in all_schedules:
try:
if schedule.KeyScheduleParameterName == p_key_name:
key_schedule = schedule
break
except:
pass
#💡 Ensure you found matching schedule
if not key_schedule:
forms.alert("Can't find matching Schedule.\nPlease Try Again.",
exitscript=True)
#3️⃣ Get Possible Key-Parameter Values
key_values = FilteredElementCollector(doc, key_schedule.Id).ToElements()
dict_key_values = {key.Name : key.Id for key in key_values}
#👀 Display Key-Parameter Values {Names: Id}
OUT =p_key_name,key_schedule,dict_key_values
That’s schedules not colour fill schemes?
ok, i thought you wanted to get the related parameter. I think this schemes are not exposed to the Revit API…
It’s there as of 2022 I believe.
I did look at that… And I tried, “Cateogry” but no joy.
Even though category is listed in properties.
I have filtered by name atm as we’re using Room Name schemes… but I’d like to be able to filter by the main category.
The Category
property will always represent the element’s own category.
In this case, you want the CategoryId
.
Hi,
For information, there are several nodes in the Genius Loci package for color schemes.
But it will be less fun than digging into the API.
I am using some
But I wanted to do something specific with the other bit that I don’t think your package does?
EDIT:
OMG… I just saw… it DOES!!!
Oh dear… All that work. sighs
Well, at least I’ve learned something.