I tried batch processing files on the Mac, but since opening a file opens another window, it didn’t work. Does anyone have had succes doing this on the Mac?
I would be interested too, I tried this a long time ago and gave up for the same reason…
if you gave up that doesn’t sound hopeful…
Rhino 6 for Mac allows launching with command-line parameters like -nosplash
or modelname.3dm
…even -runscript
…see: Launching Rhino for Mac with a runscript argument.
I can imagine you could either write a bash script to do this or perhaps even use some combination of Rhino’s macros _Open
,_Close
, etc. to do this.
I’d be curious to hear where you hit snags.
Note: this was not possible in Rhino 5 for Mac.
On Windows, I can just open Rhino, Open the PythonScript editor and run a script that opens several files in a for loop. Do you mean with the last method in that link (that mentions: for longer loops…) this is the one that does this?
The problem is (in my understanding anyway) that scripts run inside one Rhino “window” on Mac, so when you “Close” that, the script is terminated. Is that not the case?
I guess I don’t know what you want to do.
Something like this? Here’s a bash script that will launch Rhino and do something (in this case something arbitrary) for each 3dm file it finds in a folder…
#!/usr/bin/env bash
FILES_TO_BATCH_PROCESS=/Users/dan/Desktop/FolderWithFilesToProcess/*.3dm
for f in $FILES_TO_BATCH_PROCESS
do
echo "Launching Rhino and opening the $f file..."
/Applications/RhinoBETA.app/Contents/MacOS/Rhinoceros $f -runscript "_Line 0 10,10,10 _Save _Quit"
done
Sure, these are not running in the same session of Rhino, but neither are they on Windows really.
Think of this like writing a batch (.bat) file on Windows. Bash just runs on nearly all posix systems - now even Windows 10 I believe.
To test the above:
- Save the text above as a file somewhere. For example: ~/Desktop/testBatchProcess.sh
- Create a folder somewhere with test 3dm files to process. Edit testBatchProcess.sh and point the
FILES_TO_BATH_PROCESS
to that path. - Launch /Applications/Utilities/Terminal.app.
-
cd
to your~/Desktop
(or wherever you put the script) - Run the script with
./testBatchProcess.sh
OK, so there is not a pure Python/rhinoscriptsyntax way to do this from inside Mac Rhino - i.e. just running it from an alias, button or similar…
No, I do not believe so. Now that I see you want to do this from an alias, button, etc, I understand why this is a limitation.