My typical scripts I make are hooked up to a LunchBox bake component, controlled by a button. As of right now, the script is controlled every time I push the button, and it bakes the result of the script into the Rhino file.
Anyways, I have had several past projects where I need to process close to 1,000 files (and there is an upcoming project as well where I need to process a large amount of files). As you imagine, I have been processing those files individually (opening them one-by-one over a week at a time). I would imagine that there is a more efficient way of doing this, automating the process somehow…?
I’m currently learning Python, so I have tried to utilize some code from this post, Open and Close a 3DM File. With that code I can successfully open each file in a directory, but I am having a hard time saving any added features in it. I’m not sure what to do.
Thank you for the quick reply. Your example helped me figure out a solution.
To answer your question:
Why can’t you save the added geometry?
I was not calling the active doc… .
This is what I ended up doing:
import rhinoscriptsyntax as rs
import Rhino as rh
files = System.IO.Directory.GetFiles(
for file in files:
rs.Command(’-Open ’ + file)
I simply plugged inputs in, formatted the code, and it works!