# Gradient colouring from excel data

Hello everyone,

I’m new on this forum and a true beginner on Grasshopper.

Could anyone share with me his/her opinion and knowledge about my definition ?

Here is my goal : I would like to colour the faces of a solid according to data contained in an Excel worksheet. The solid is a parallelepiped. Each side is divided into 3 subsurfaces. I would like to colour each subsurface according to the value included in the excel worksheet.

First, I’ve just tried to build a simple definition with no external data. The point was just to validate that I could select a specific face and then a sub-surface and colour it according to a specific value using sliders.

I’ve tried then to read data from a very simple excel worksheet. I think I’m Okay with this step. The next one is a bit more challenging for me: transforming these data into numbers and connecting them to the gradient component.

In the excel worksheet, the “surface” row refers to the position of the subsurface (0 = bottom, 1=middle, 2=top) and the “Value” row refers to the value to be used for colouring the subsurface.

I’m stuck at this stage of the definition. How to make a bridge between the excel data and the gradient component ?

rep plateau.gh (14.3 KB)
Sample.3dm (30.6 KB)

It would be helpful to read the Excel data for us and internalize it in the GH file, so we don’t all need these plugins and your Excel file (which you didn’t post anyway).

Your Rhino file has only one curve (a square) and it’s apparently not connected to your GH file, though I can deal with that.

I don’t understand how ‘Value’ relates to color?

rep plateau_2023Jun20a.gh (12.4 KB)

Curve is internalized, no need for Rhino file.

I wanted to share the excel file but couldn’t upload it.

Let me give you a bit more context. The extruded curve simulates samples that I have 3d printed. On these samples, I have made roughness measurements on each faces ( exactly 3 measures by face at 3 different height positions). Each measurement provides a roughness value expressed in micrometres. These values are compiled in an Excel file.

I would like to create a graphical presentation of these values .
Concernning the relation between ‘Value’ and colour, the rainbow scale is supposed to represent the scale of values measured on the faces. It goes from 0 to 15 µm at the most. Each ‘subsurface’ has a roughness ‘value’, so basically, I’ll have 3 ‘values’ per face, i.e. 12 values per sample to convert into a colour according to the gradient.

I hope it will help.

Not at all. I don’t want the Excel file and don’t want to install plugins to read it. As I explained, I want you to internalize the Excel data. Don’t hold your breath expecting me to do any more on this.

I apologise if you thought I expected you to provide me with a full definition. My aim in providing a little more context was to answer a question that I clearly didn’t understand, namely: 'I don’t understand how ‘Value’ relates to colour? .

As I explained earlier I’m a begginer at Grasshopper and I’m not sure about the way to “internalize the excel data”. If you agree to give me a boost, you will find my try attached. if not then thank you again for considering my first request and have a good day.
rep plateau_2023Jun20b.gh (17.6 KB)

3. Attach minimal versions of all the relevant files

1 Like