I have multiple sequentially named STEP files, each containing a open BRep. I’ve developed a custom component that reads all STEP files from a specified folder and can output BRep one by one based on an index number. I’m looking to automate a process where each output BRep is fed into the built-in CapEx component (e.g. number looping from 1 to 10), then baked and saved one by one. How can I set up this automation in Grasshopper?
Any guidance or scripts that could help would be greatly appreciated!
Try using the new import content component in Rhino 8. Then the model object component to define object attributes. Exporting is not fully solved with the current Rhino Grasshopper components but can be done with a script from Rhino.
Using the new model object tools it is easy to read in multiple files and then write them out as other file types.
I use the new Import file component to read the files. Then wrap what is needed in a block that can be written out as any other format. This works for standard reading and writing file conversions.
For more extensive control using python or c# components to write files use the stuff below.
In Rhino 8 we support code driven File.IO in Python, C# and Grasshopper. For more details on how to do this, see:
In Rhino 8 there is a Query Directory component under the Rhino Menu in Grasshopper. It will find files within directories. Use a Wildcard search to find specific file types. It also can search sub-directories.
Combine that with a Import Contents component to read all the Model Objects out of the file. This would work for any file type Rhino can read.