Create gradient with sevral colors and use specific min and max for AVF

Create gradient with sevral colors and use specific min and max for AVF

Anonymous
Not applicable
1,640 Views
9 Replies
Message 1 of 10

Create gradient with sevral colors and use specific min and max for AVF

Anonymous
Not applicable

Hello,

 

I'm creating a plugin which compares a point cloud and floor or wall in revit. My problem is that i already use AVF to display my result, but i havbe a color for the max and a color for the min, but that's all. I want someting like this : 

Facade sud.png

There is serval colors for things which are above or ahead.

 

I also want to set in the code the min and max values of the legends as it is here, Because i Don't find how to set those values.

 

The only way that i found to have multiple colors if to use points marker and not gradient in the AVF. But doing that, it is unreadable and i have a legend for the negativ part and a legend for the positiv part.

 

Please help me with the AVF

0 Likes
1,641 Views
9 Replies
Replies (9)
Message 2 of 10

jeremytammik
Autodesk
Autodesk

Thank you for the interesting question.

 

Please be aware that the Revit API hardly ever supports any functionality that is not also available in the user interface.

 

Are you able to set up an analysis visualisation manually through the user interface that fulfils all your requirements?

 

If not, then it is probably not possible to do so programmatically though the API either.

 

Still, I will gladly raise this question for you with the development team.

 

Can you please specify clearly and succinctly all your requirements in one single list, since I find it hard to extract your exact needs from the description you give.

 

Something like:

 

I need to specify:

 

  • min value
  • max value
  • min colour
  • max colour
  • min legend value
  • max legend value

 

Anything else?

  

I do not understand the requirement to specify "serval colors for things which are above or ahead". What? How?

   

Thank you!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 10

Anonymous
Not applicable

Thanks for your interest in my question. 

 

I’ve never try to do this trough the user interface. In fact, I m not a Revit user, I am a developper and I’m working for someone who use revit.

 

But it’s the first time that I create revit plugin and so it’s a bit hard to understand everything.

 

And to clarify, I want to do the exact same thing as it is on the picture. 

- I want the min and max values on the legend to be always the same for exemple i want my legend to be from -1m and 1m every time (because in my actual plugin the min and max value are determined by the analysis result that I display i can’t choose them)

- I want to have different color for some key value in the legends, like green for the 0, red for the max and blue for the minimum. As it is in the picture, if you look at the legends, there are different color depending on the value, and not a maximum color and a minimum color. (for exemple, in my plugin I compare a point cloud and a wall. if the distance between the wall and the point is 0,12m it will be a color between green and red (because it is in front of the wall) and if the distance is -0,51m it will be between green and blue (because it is behind the wall))

0 Likes
Message 4 of 10

jeremytammik
Autodesk
Autodesk

Was the image created with Revit? If so, then that obviously proves that it is possible.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 10

RPTHOMAS108
Mentor
Mentor

It sounds like you are looking for:

AnalysisDisplayColorSettings.GetIntermediateColors & AnalysisDisplayColorSettings.SetIntermediateColors 

 

This I found via RevitLookup after adding via the UI, learning how to do it in the UI is essential for developing Revit add-ins.

 

It doesn't seem like it is possible to display a value in the legend that doesn't exist in the results e.g. in the below the results values are from 0 to 10, so red is not shown in the Legend (we also see a bit of merger towards cyan since we have no colour for zero in the settings):

 

201109.PNG

Message 6 of 10

Anonymous
Not applicable

Yes it was created by the revit plugin « Undet ». 

0 Likes
Message 7 of 10

Anonymous
Not applicable

Thanks a lot ! It seems to be a very good solution ! I will try it and let you know if it works ! 

0 Likes
Message 8 of 10

Anonymous
Not applicable

So it works, i set multiple color as you did. So this part of the problem is solved ! thanks, but to add min and max values to the legend, i did that by adding "fake" points on the analysis, I mean that i wanted me legend to go from -0.5 to 0.5 so i created two points with those values and i Don't know how to do it in a ggod way

0 Likes
Message 9 of 10

RPTHOMAS108
Mentor
Mentor

Sounds like an approach bearing in mind that you still need to reflect the correct value at such a location to not affect the distribution of colour from that location further out. If the colour decided for multiple data at the same point is decided by mean average rather than median then the actual value there could be an issue:

e.g. (-0.5 + 0.25 + 0.5)/3 = 0.0833 not 0.25.

 

I don't know how that is decided.

 

 

0 Likes
Message 10 of 10

jeremytammik
Autodesk
Autodesk

Here is code from The Building Coder webcam implementation in the year 2010 that sets the min and max colours as well as the legend scaling:

  

https://thebuildingcoder.typepad.com/blog/2010/06/display-webcam-image-on-building-element-face.html

  

    // color settings:
 
    AnalysisDisplayColorSettings colorSettings 
      = new AnalysisDisplayColorSettings();
 
    colorSettings.MaxColor = new Color( 255, 255, 255 );
    colorSettings.MinColor = new Color( 0, 0, 0 );
 
    // legend settings:
 
    AnalysisDisplayLegendSettings legendSettings 
      = new AnalysisDisplayLegendSettings();
 
    legendSettings.NumberOfSteps = 10;
    legendSettings.Rounding = 0.05;
    legendSettings.ShowDataDescription = false;
    legendSettings.ShowLegend = true;

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes