Create color scheme with dynamo, how?

Hello,

Is there a python-node or a package that support create colour-scheme via dynamo
i would prefer to create via .csv list?

KR

Andreas

Hi @Draxl_Andreas,

it is possible with the Genius Loci package but only with Revit 2022.

3 Likes

Like @Alban_de_Chasteigner said:
it is possible in Revit 2022…
https://www.revitapidocs.com/2022/bdc51109-355d-dc7d-9b43-c59ab1357479.htm

1 Like

Oh no we use Revit 2021!

I have to find a way in python can i change this at least or is it more complex:

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
scheme = UnwrapElement(IN[0])
out = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

elems = FilteredElementCollector(doc,Scheme.Id).ToElements()

for scheme in FEC(doc).OfCategory(DB.BuiltInCategory.OST_ColorFillSchema):
    if scheme.Name == 'Raumnutzungsart':
        scheme_entries = scheme.GetEntries()

for i in IN[1]:
	new = ElementTransformUnils.CopyElement(doc,elems[0].Id,XYZ(0,0,0))
	elem = doc.GetItem(new[0])
	elem.LookupParameter("Raumnutzungscode").Set(i[0])
	out.append(elem)


TransactionManager.Instance.TransactionTaskDone()

OUT = out

or it means the API comment is in 2021 not aviable ?

It is not possible in R21, only in R22 or newer as time goes. The API does not expose it before that.

FYI: Here is how I have done it in R22. It uses the same principal as the Key Schedule graph, but it get a single entry, changes the info, then adds that to Scheme.

2 Likes