Applying color to and manipulating cube location

Hi!

I’m quite new to Grasshopper; what I thought would be a relatively easy exercise has become quite hard. What I set out to achieve was…

  • Take values from Excel in a format of ‘1,2,3,4,5’ etc. which represents different colored ‘cubes’

  • I then wanted to overlay the output number by color, for example; 1 Green Cube, 2 Yellow Cubes, 3 Red Cubes etc. (the colors are representative of different program requirements)

  • What I really wanted to achieve after this however was to take the selection of cubes (of different colors) and randomize them based on how a slider was changed

I have attached my trial Grasshopper photos below. Because I am not great at the program I made a video to hopefully explain the idea better.

I was hoping to figure out if the idea is possible; How to color cubes based on values from excel, and how to manipulate the color set, and what approaches I might take to begin.

Thank you very much!

Grasshopper Script Main.gh (18.9 KB)

1 Like

Hi bthendo,

When I look at the file you uploaded, it seems that you are trying to partition the architectural space based on the data(zoning).

In the video that you uploaded, the modules of the same type are attached to some extent. So I assume that you don’t want to arrange various modules based on perfect randomness.

Therefore, I placed modules along with the boundary of the whole space so that the same type could be attached as much as possible. Then, I shuffled modules to be random. Please refer to the file for further details.

As I wrote in the GH file, this algorithm works only when all modules are connected. (One building & One floor)

And you should install “TT Toolbox” before loading this GH file.

Lastly, after loading, you should update the directory of the Excel file and click “Excel Link Toggle” two times to connect the Excel file and the GH file.

If there is more question or errors in the algorithm, please let me know.

191014-Data-Based-Zoning.gh (32.3 KB)
Space-Data(Excel).zip (7.3 KB)

@newdragon88 I opened it updated it as you said I couldn’t get 3d box.

I get multiple errors.

Like data conversion failed text to number.-equality
Input parameter E failed to collect data.- boundary surface.
How to slove it

I could not understand the errors that you said.
When you loaded Grasshopper, wasn’t there a warning sign saying there are components you haven’t installed?
If not, can you explain a bit more about the errors with screenshots or some other images? :cry:

1 Like

I apologize

Screenshot attached

@newdragon88

Hi Rosh,
I think that something went wrong before Equality. So I ask you to upload whole algorithm screenshot with “File > Export Hi-Res Image”.

Now I completely understand why the error occurred in your algorithm. :smiley:

Based on your Excel file name (book (1) .xlsx), it seems that you’ve run the algorithm based on your own Excel file. And because there was a “character” in the part that only needs “numbers”, the “Equality” component has encountered an error comparing the character with the number (in this case : 0).

Please look at the two images below.

Path 1 in the “Panel” component on the Grasshopper canvas corresponds to column A in the Excel file. Path 2 corresponds to column B in the Excel file. In each panel, the index number corresponds to the row in each column.
In the “Cull Index” component, I removed the index number 0 and -1 items, which means I deleted data in rows 1 and 13 of each column in the Excel file. (A1, B1, A13, B13).

In your case, I think that there is a character in the part that should only have numbers, like the Excel image above. Or, unlike I erased lines B1 and B13, the lines with characters that need to be deleted are still not erased.

Therefore, like the “Panel” component in the image below, you need to make sure that only the pure numbers from the data loaded from Excel are entered in the “Jitter” component.

If my reply still doesn’t make any help, please zip your Excel file (Book (1) .xlsx) and upload it here.

Lastly, you have to exactly match the total number of numeric data in the Excel file to the total number of modules in Grasshopper. In my case, total is 38 in Excel and 38 modules in Grasshopper.

1 Like

Thank you @newdragon88