Hi all,
I’m trying to generate (and export to STEP files) different geometries by starting from points coordinates stored in a csv file. I have successfully done it for a single vault, but I don’t know how to do it many times (like 625 times or even more). I would like to automate the process of generating several vaults from points coordinates and exporting them to several STEP files. Does anyone know what to do or point me in the right direction?
I could use Python, but I can’t figure out how to proceed.
I attach the file so that you can see where I have gone so far.
Firstly strip down the file and experiment with 2 or 3 things max, not 625 until you’re sure it works.
I would programmatically create a new file name for each from its points coordinates (even if it’s just giving it a number). Then work out the exact sequence of steps needed to be taken, from just after having saved the previous file, then creating a new blank file, starting to make the geometry of the next one, all the way to saving or exporting that as a STEM file too. Then express those steps as a Rhino command string with normal Rhino scripting commands. And then call that command string with rhinoscriptsyntax.command. After that, the hard work’s done. Standard iteration is all that is left to do.
In Python you can either iterate though the csv file in a for loop and call that code as a function. Or have one component read the whole file. And export a list into GH, and have a different component with an item input, and run that on every item of the list
Do you have 625 CSVs or 625 sets of data in one CSV file?
For the first one, read all the CSVs (you may use CSV to Assoc from Pancake to facilitate reading CSV). For the latter one, you should specify how data is separated.
Here’s an example how you process CSV with Pancake.
Hey @gankeyu, first of all, thank you for your code. I tried it myself and works perfectly! The only problem that I have is producing multiple geometries. Each of them is to be stored in a different output file with a different name. Ex: I have 3 input csv files. In each file, I have a set of 5 points (x,y coordinates). Such files can be something like the ones attached (set1.csv, set2.csv, ses3.csv). From them, I would like to generate 3 output STEP files (attempt1.STEP, attempt2.STEP, attempt3.STEP). To obtain these STEP files, I’ve manually changed the input csv file name, and the output name, and hit the “TrueButton”. Anyway, I aim to find a way to automatically repeat the entire code, since I should do it many times (625 or more). I can’t figure out how to do this because it appears that I can define a unique csv file name with the two first components (DefinitionPath and Concatenate). Similarly, I have the same problem with the output file because I can set only one “File Location” with the “Export As” component. Do you have any idea? I’m looking around and I’ve found “Anemone” as a potentially useful plugin. Do you suggest anything different to implement your code?
PS. Even if have attached 3 different CSVs, I can easily generate 3 sets of 5 rows each (or another fixed number of rows) in one CSV file, so it might be possible to do something recursively.