Script to import files in folders, subfolders

I need to import .dwg and .step files from several folders (to rhino format).
I’m not sure of the best option to choose when I see the number of possibilities I have to do it.
I am running Rhino on Mac.
Is there a shared script ressource where I can find a similar script?
Otherwise, which langage should I start writing my script in? RhinoScript? PythonScript? Applescript (does not recognize the Rhino app).

I have a Python script that does this and works in Windows. Unfortunately, currently it will not run on Mac as the function rs.BrowseForFolder is broken @Alain, so I don’t have any way to have the user specify a folder if they are running on Mac… Even then, I’m not sure it works 100%, but now I have no way to test… Maybe it does work in the V6 Mac WIP…

Rhinoscripts do not run on Mac in any case.

1 Like

Quite happy to read that, it makes it less complicated…
Thanks for the info, its good to know, feels like being on Mac makes it more complicated whatever the option I choose.
Maybe I can use an applescript + a Python script. I have an applescript which can open all files in a folder, but is stuck when it comes to comes to controling Rhino. Maybe I can use that then start the python script from the applescript, what do you think of that ?

Well the best thing would be that rs.BrowseForFolder can be made to work again in MacRhino. Looks like it’s on the top of the pile to be looked at, but even if fixed today, it would still be awhile before a new build will be released to the public with the fix… It may already work in the V6 for Mac WIP, but I didn’t have time to test over the weekend, and I am Mac-less today.

1 Like

Good morning @Helvetosaur,
Indeed I have Rhino 5.5, I’m afraid I won’t have time to wait for the next build release. I checked for the other posts about the subject, no workaround available for the moment.
Seems like I will have to use Applescript for this specific command. Then I need to switch to a python script.

**tell** *application* "Finder"

**set** MyDWG **to** ( **every** *file* **of** entire contents **of** MyFolder **whose** name extension **is** "DWG") **as** *alias list*

I have just tested the batch import script below in the latest WIP and it works… Still does not work in V5 though. (5.0 KB)

Note it may be slightly confusing as the Browse for Folder dialog on Mac does not have a title or message, so as soon as you run the script, it opens a browse window with no indication of what to do. You just need to know that this is where you find the folder you want to import files from.