Rhino 7 Scripting or Macro to Create Objects from an Excel list

I’m a novice coder, and I am attempting to write a rhino script that would create simple boxes that represent major machinery components found in a ship, and also place them in the correct location. The corresponding length, width, and height dimensions for the machine components and their x,y,z locations are listed in a separate excel file that’s part of a large design tool and the information in the excel file changes based on the ship design. My plan is to call up this dimension and location information (from excel) into my script, and build boxes for every component that is listed. These boxes would then be displayed in Rhino/orca, and be color coded based on type of machinery.

If anyone is willing to provide me with some basic advice on how to accomplish this task, I would be very grateful! Thank you so much.

Hi John, Can you post a sample of your structured data (excel or csv)?

Thanks!

Thanks for the reply. This is a very simple sample of redacted data showing some dimension info for three engines. The location info is in the same simple format, but instead of physical dimensions of the component it is the component’s distance from a reference point 0,0,0 which I have put at the bow of the ship.

image

Here’s a quick Grasshopper example of creating boxes per CSV, which could be a referenced .txt, .csv or excel file.


re_BoxesFromExcell.gh (9.6 KB)

If Grasshopper is an option for you please change the category of the post to Grasshopper. Thanks.

2 Likes

This is awesome! Thanks so much for the support. Do you have any recommendations on how to input x,y,z location information in a way to position the boxes correctly in Rhino? I’m a bit confused on the top left (series- Construct point- panel). I’m tracking it well up to the move function though. Thanks.

In this case I separated the location due to using CSV as the example and the points format contains commas.

The move function was required to move the center of the box by half its Z. Depending on how your data is truly structed will govern a lot of this. The more information you can provide the easier it will be to help.

Here’s a quick example of Relative Points (or Points Oriented to a plane)

re-relative-points.gh (6.8 KB)

Relative Example Points Gif

relativePoints