Anyone have an Open/import script for combining Rhino Files

I am trying to automate visualizations of a permutation of objects and don’t know even where to start looking or the basic framework of how to accomplish this. I need a little help understanding the 60k foot level of this so I can find help to accomplish this (I don’t know python or scripting…yet).

I will use an analogy of a cars and wheels/rims although that is not exactly what I am doing.

I want an interface that will allow me to select from my library of .3dm “Cars” which all have the center of the axle at the 0,0,0 spot. (selection being in File Explorer)

Then prompts me to select from a library of wheels and rims .3dm which have all got a cooresponding 0,0,0 location so they should import to the right spot on the car.

The above is the hard part I am looking for direction on how to accomplish. But the workflow (automated) would then Select the combination of the Car model and the Wheel Rim and export it to a new folder as an .obj … MIght take some jpegs of renderings and save them etc in an organized fashion.

Basically this is a version of a product customizer, but it is not customer facing. I want the only manual part of this to be selecting the combinations… or maybe a multitude of combinations… aka I just got a new model of a car and I now want an .obj file of this new car, with EACH of the 75 rim/tires I have already designed.

What are the big pieces here that I need to research? Anyone want to consult on this?


Block Rhinoceros Help
BlockManager Rhinoceros Help
BlockEdit Rhinoceros Help
Insert Rhinoceros Help

If your ‘wheels’ are all in separate files and located in the right spot then a batch import/export shouldn’t be too hard to script.

The basic procedure is this:

Open the ‘car’ file. This is your master file.
The 'wheel files should all be in one directory

With the master file open, with a script do the following:
– Ask the user to choose an export directory for the .obj files
– Ask the user to locate the directory where the ‘wheel’ files are
– For each .3dm file in the ‘wheel’ directory:

  • Import the file using a scripted Import command
  • Select both the ‘car’ and the newly imported ‘wheel’
  • Export .obj (with custom settings if necessary)
  • Delete the newly imported ‘wheel’ geometry
  • Repeat for all the other files in the ‘wheel’ directory (loop)

The most difficult part of this is figuring out the proper command strings to use when scripting the Import and Export commands inside Rhino via rs.Command().

I can create some samples later on - unfortunately don’t have time right now.

Here is a sample script with some comments… (3.0 KB)

Super nice of you to chime in Helvetosaur. Thank you. I am needing to roll up my sleeves and get out of the Macro/Alias realm and dive into Scripting and Grasshopper direction. I will look into your examples with interest and revert.

If you are going to look in the Grasshopper direction, the eleFront plugin has several tools that allow you to sort / filter geometries that you reference in (including from outside models, as in a LinkedBlock), as well as enabling baking and exporting in a scripted fashion. Could be an option if you want to use an existing plugin.

1 Like