Setting a wall's coarse scale fill pattern color

I was trying to change my walls’ coarse scale fill pattern color but I soon realised that I was going to have some problems converting my rgb’s into RevitColors(?). I found these two Revit.Color nodes from Clockwork but if I try feeding RevitColor.FromDynamoColor into Elements.SetParameterByName the node won’t work…(I need to input a number,e.g. 13755072, instead of Autodesk.Revit.DB.Color)

I managed to make it work by manually inserting the color I want directly in revit (only for one wall), then reading its value and finally feeding it into Elements.SetParameterByName but I was wondering if there was a better way.

Thanks

1 Like

See this link for the logic behind the number:
http://thebuildingcoder.typepad.com/blog/2013/04/migrating-a-built-in-category-and-other-things.html#3

#Storage of RGB Colour Values for Materials

Question: I looked at a material element ‘Color’ parameter value today. This parameter values comes back as an integer.

It appears to me to have the red and blue values reversed.

When looking at the ‘Site – Earth’ material in the rac_advanced_sample_project included with Revit, the Color property on the material class returns material.Color.Red=97, material.Color.Green=75 and material.Color.Blue=62, which is also what the Revit GUI shows in ‘Manage Materials’. I checked on an online colour generator web site and it looks the same as in the Revit GUI, a dirty brown colour.

However, the integer number that comes back from the ‘Color’ parameter on the material element is 4082529, which when converted to RGB values using online converters, comes back as Red=62, Green=75 and Blue=97, which is a bluish colour. The Red and Blue values appear to be reversed.

I would have expected the integer 6376254 to be returned for this colour instead.

Can you explain this, please?

Answer: Yes, easily.

This is actually working as expected.

Revit uses the Windows convention of storing colours as an RGB COLORREF value in a DWORD (32 bit integer) that specifies “The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue”.

In other words it is (A)BGR and not (A)RGB.

This corresponds to the value of the integer returned from a Color parameter.

1 Like

Hello, Springs has a node called “Color2Decimal”, that’s probably what you need…

2 Likes

Hello,

I’m interesting in setup up something similar but not worried about what colour the Basic Wall Coarse fill colour is just as long as there all different just like the colour scheme for rooms

I’m fairly new to dynamo so some help on which nodes would be best would be great.

Thanks

Maybe an easier approach would be to add a Wall category in drop down just like we now have Pipes & Ducts. Could this be possible with dynamo?

Thanks

Right now I unfortunately do not have time to play around with dynamo but you could look into these nodes:
“Categories”, “All elements of category” to select certain objects
“Get parameter value”, “List group by key” to read a parameter and group the elements (eg you want each wall type to have a different color)
“Count” to count how many groups you have
“Math.RandomList”,multiplications and “Color.ByARGB” to create a random color (red green blue values go from 0-255, while random numbers go from 0 to 1, so you have to multiply the random number by 255)
“Element.OverrideColorInView” to apply the color to the elements in a view

This approach is kind of quick and won’t let you decide what color to give each element (unlike the room color scheme)

What’s the name of springs.color2decimal package.
I know the nodes name but didn’t know how to find the package.
Could you send that package name to me please?