Color picker

Color picker

ahmed.errazak
Enthusiast Enthusiast
1,916 Views
6 Replies
Message 1 of 7

Color picker

ahmed.errazak
Enthusiast
Enthusiast

Hello,
there is a possibility to call Revit(2019) color dialog box? 
Thank you Smiley Happy

0 Likes
Accepted solutions (1)
1,917 Views
6 Replies
Replies (6)
Message 2 of 7

recepagah12
Advocate
Advocate

You can check out the dynamo package named RHYTHM and its UI.ColorPicker. 

It is a custom created dynamo node and you should be able to inspect it and learn the source code.

 

I hope this helps,

Recep.

0 Likes
Message 3 of 7

dnenovMXKU9
Enthusiast
Enthusiast

The Revit Revit one is not exposed, as far as I know. 

 

What I've done in the past (and, alas, I couldn't find my code to help you out further) is use Widnows Forms Color Picker and modify it for my needs. 

 

The thing to watch out for is the conversion between Windows Color object and Revit Color object. You will need to get the RGB values from the Color Picker and turn the into Revit colors. For more information refer to this thread for example.

 

I hope that helps.

0 Likes
Message 4 of 7

JimJia
Alumni
Alumni

I think the ColorSelectionDialog API is what you desire.

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
Message 5 of 7

dnenovMXKU9
Enthusiast
Enthusiast

No waaay! This is so good!

 

That should be the answer.

0 Likes
Message 6 of 7

ahmed.errazak
Enthusiast
Enthusiast
if it's not too demanding,  how do you call the function
0 Likes
Message 7 of 7

recepagah12
Advocate
Advocate
Accepted solution

I think you haven't much experience in C#. Just pass a class instance and use the show method.

ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog();
colorSelectionDialog.Show();

 

After that, you can get the selected color via, its selected method.

 

 

I hope that helps,

Recep.

0 Likes