Hello,
I tried to place color palette nodes in a user interface (I couldn’t)
Therefore I went through a color pickup, is it possible to recover (the a,r,g,b of Autodesk.Revit.Db.Color)
Thanks in advance for the help provided.
The Red, Green and Blue values are properties of a color in the Revit API. So assuming you have the proper imports, you can try this:
colors = IN[0]
rgbValues = [c.Red, c.Green, c.Blue for c in colors]
OUT = rgbValues
If you import the DSCore module as well, you can then directly generate the Dynamo color values. SOmething like this:
#Standard imports here
clr.AddReference('DSCoreNodes')
import DSCore
revitColors = IN[0]
dynamoColors = [ DSCore.Color.ByARGB(255, c.Red, c.Green, c.Blue) for c in revitColors ]
OUT = dynamoColors
There may be a Revit.Color class somewhere, but I haven’t come across it. Genius Loci package, or another package which deals with materials may have something. I am 90% certain it isn’t in the Revit section of the library, which means I am 90% certain that some type of custom code would be required, be it Python or a zero touch node.
Whenever I have needed to convert colors between applications I have just done the above in my code base, as it’s simple enough that it doesn’t necessarily slow down efforts, while moving along an extra node or two might…
dragging up an old thread so I dont have to make a new one- Im a python noob, when I run this I get an iteration over non sequence error. Im kinda stuck in a graph where i need to convert a revit color to a dscore color. help ^^
Wait, I have noticed my python scripts execute before my graph, this might be the issue, because I am passing it a revitDB color from a Datashapes UI. will post tho.