Is this possible? Processing a batch of files (please see attached image)

Hi Guys,

Thanks in advance for any assistance this form is an excellent resource!

(Please see the attached image first)

I have created a Modifystl.gh to edit a .stl file which I would like to use to modify batches of .stl files automatically.
I am looking for some guidance on how complicated it would create a process which involves the following:

  1. The user selects a folder which contains subdirectories with .STL files with a consistent keyword in their filename
    2)The first file is modified by the Modifystl.gh
    3)The modified file is saved with an edited filename
    4)The process is repeated for the remainder of the files in the folder selected in step 1

(Please see the attached image for a better description)

Best Regards,
K

Hi,
In principle this is very possible. I would personally want to automate the file handling with Python but there are certainly other scripting options. The devil is in the details:
•What do the stl files have in common?
•What is different about them?
•What is the transformation process?

1 Like

Hi Graham,

Thanks for responding to me. Please see the attached .gh The .stls are all 3D scan and will undergo a Boolean operation using the dendro plugin to add a logo to each .STL (Which I have removed as it is quite long winded and is working without issue).

The process I have attached works perfectly for individual files but getting it to work and run multiple files in a batch would be a massively time-saving improvement. Again, any help is greatly appreciated.

Auto load rename and save.gh (9.8 KB)

Regards,
Kevin

ahhh I may have spoken too soon.
I know how to iterate over a series of files in Python using the os module:

import os
cwd = "c:\\some\\path\\"
a = []
for filename in os.listdir(cwd):
    if 'pattern' in filename:
        a.append(filename)

But I’m not sure how to import the stl file - I cant see an stl importer on my system (Rhino v5)

1 Like

1 Like

Hi Graham,

There is an importer in the attached .GH. To be honest I’ve pieced the whole .gh from individual form solutions for importing and saving stls. These are the fastest scripts I have found. I would hope that the additional requirements to import save and rename batches of files from a folder would require an amend to the import/export script. Is this wishful thinking?

Regards,
Kevin