Override Dimension Styles

Hello :slightly_smiling_face: 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:

  1. Is there a way to define the G and B value of the color in this script?
  2. Is there another way to set color for dimensions?


Thank you in advance for help :pray:

Did you try something like this already?

255,155,055

image
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. :cry: I’m really new to Dynamo so don’t have any clue

Hi,
Maybe a solution like this


Sincerely
christian.stan

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.

1 Like

Maybe this?

If not then i ran out of ideas.

1 Like

It seem not easy
Look on package rythm(M. John Pierson is the autor of package)

Cordially
Christian.stan

I noticed that too! :exploding_head:

1 Like

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…

Revit_wCcbpiw9CA

or set the color

3 Likes

Hi sovitek, that Color.ToDecimal looks like what I need. But I cannot find it in my dynamo. Is that a plug-in?

that one is from spring package

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)

image

1 Like

Thank you soviteck, it works!

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

And just for completeness, here it is as a single line of design script:
decimal = c.Blue*256*256+c.Green*256+ c.Red;

3 Likes

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!

2 Likes

No worries! We try to give options like these when possible, as @jacob.small puts it, just for completeness.

2 Likes

Thanks jacob!