Color2Decimal

Hello Dynamo Community,

Is there a way I can enter a string into Color2decimal? Right now its looking for (Color) but I want to have it so someone can enter the color into an excel and set the color of the hatch in a filled region.

Would this be possible?

Thanks!

Use a dictionary to map the colors (dynamo objects) to the strings (color names users will type in excel). Be sure to have a means to limit what people type in excel - Redd won’t work in your dictionary unless you define it.

There may be easier ways to do this in the end.

Thank you Jacob. I can map the colors but they will still be strings not colors to send into the color2decimal node.

Build a dictionary where the keys are the strings and the actual Dynamo color objects are the values. Then take the values from excel and use them as the key input of the Dictionary.ValueAtKey node.

Hi Jacob,

I dont know why its not accepting the new parameter value. Any thoughts?

Thank you!

What does the error say? Is your parameter a string parameter?

We really need the full graph and associated files (a sample RVT with the element who’s ‘color’ value you are setting in it, and the xls) to help here. Very unlikely that your value wants a double as you have it set up now.

Thank you I appreciate you taking a look. The revit file I am using is just four rooms I created to test the filled region creation on.
Filled Region from Room Boundary.dyn (122.3 KB) test.xlsx (8.3 KB)

RVT may just be four rooms, but the parameter’s storage type will matter so we need that too. Even if it doesn’t matter based on what we learn by opening the .dyn, without it we would have to spend time rebuilding your test data set (simple maybe but still it’s time spent). Note that this method will likely vary for filled region types between Revit versions as well.

Please help us help you and upload the rvt you mentioned.

https://drive.google.com/drive/folders/12ZCyx6GyHE8jnx-xIOzy2x1IgISs_vOk?usp=sharing

Let me know if you have trouble downloading. the RVT file was to large to upload here.

1 Like

Hi, @jacob.small and @Nick_Boyts,

I found that when I used the “Element.setparameterbynametypeorinstace” node it set the color but would not work when using the, “element.setparameterbyname” node.

Thank you for taking a look!

So it’s likely a type parameter.

1 Like