Hello I’m new to Dynamo
I’m trying to write a script to change all the dimension colors to Purple. I found someone else’s script, but it only works for the R value. For instance if I put the value 0 it would be black, if I put the value 255 it would be red. So my questions are:
Is there a way to define the G and B value of the color in this script?
Hi bvs, yes I tried this. It doesn’t recognized the value. I also tried type in Purple, and 255-0-155, and Color byRGB. These don’t work as well. I’m really new to Dynamo so don’t have any clue
Thanks Christian for helping.
I’m working in families so it doesn’t work. I’m trying to bulk modify all the dimension style colors in all families. So I would like to change the style itself than override it in views.
Hi @bwDFDFB if i understand right you will change dimensiontype in family document, you can do it with background open or maybe better with birdtool and OOTB nodes…
If you don’t have Springs loaded, you can do it with python script or code block
def rgb_to_decimal(r, g, b):
return b * 256 * 256 + g * 256 + r
color = IN[0]
r = color.__getattribute__("Red")
g = color.__getattribute__("Green")
b = color.__getattribute__("Blue")
OUT = rgb_to_decimal(r, g, b)
Hi staylor, I have springs loaded and that works well. But I would love to learn about alternate options. I tried copy paste your code to code block and it turns red. Am I writing the code right?
It shows “{” expected in the warning. But when I change the ( to { it shows openparen expected.
Sorry for the misunderstanding. That code you have to set up in a python script. If you don’t know how to create a python script, utilize the code block that I showed in the second clip. FYI, the last output of the code block is the result return.
EDIT: Looks like you got the Springs node, so just ignore my rantings. LOL
Hi staylor I used your equation to calculate the value of the color I want. That also works.
I have no experience in python or code so I got that misunderstanding. Thanks for the alternate solution!