I am needing a little help sorting this one: would like to trigger a specific Rhino file , from a Batch (*.bat) file, and run a script on that *.3dm file.
I have seen/read here in the forum a few notes about the Rhino and batch files, but nothing seems to solve this one, am cracking my head about and decided to ask for some help, hope some of you can point me in the right direction.
Also, i think is important to mention, that there is a reason behind trying doing things like this and not trigger everything from a vbs file like it as already been suggested in this thread: Launching Rhino 5 with a batch file and running python scripts
For example, if you want to start Rhino with a file called hdri_test.3dm , render it with the built-in renderer, save the file, and exit Rhino, you would pass this:
Hi Dale,
Thank you for your answer.
This is the same as my 1st Line (green) Rhino.exe is triggered and the *.rvb Scritpt runs on an *untitled file.
I am attempting to to Start an existing File and Run the script on that file.
Thiis KB has been my starting point from the begining, however it does not seem to work in my specific case, i am guessing it has to do with the fact of having spaces in the paths:
I can confirm that this sequence works(*) as long as there are no spaces in the path of the *.rvb script. Now the question is more like, how to pass spaces into the _-LoadScript argument.
By Work I mean: it opens the specific rhino file first and runs the my_script.rvb on it. (and not on an untitled file)
heya again
this seems to work for me: "C:\Program Files\Rhino 6\System\Rhino.exe" /nosplash /runscript="_-runscript (C:\Users\Ben\Desktop\text OnSrf.rvb)" "C:\Users\Ben\Desktop\Untitled 005.3dm"
note that the scripts file name can have spaces now
My Batch File.txt (200 Bytes)
Any ideas ?
PS.: I know for sure the Script is working, and it always has been (no changes to the base rvb code have been made)
yeah no, its not your script. I made a mistake using runscript…sorry for that! Code: sais it all! I’d pass a path into the runscript that would ask for a code itself and not the path of the code.
it might not be very handy, but you could put in the vb code itself from the file.
update: doewn’t work either
problem is that you need a " to declare inside rhino a string, as you do in batch and they are one into another. rhino doesnt seem to have a Chr(34) function to avoid the double quotiations, so you are a bit stuck…
in fact your code needed to look like that, but its impossible:
`“C:\Program Files\Rhino 6\System\Rhino.exe” /nosplash
/runscript="_-runscript “C:\Users\Ben\Desktop\text OnSrf.rvb”"
“C:\Users\Ben\Desktop\Untitled 005.3dm”
I tried like 2 hours now various stuff and I think the most clever solution would be to create a script that has no space, which loads scripts with spaces in their names. something like call main main() rhino.command("-_loadscript"&chr(34)&<path>&chr(34)
it will be a ton easier once you’re “inside” rhino instead of passing through two interpreters that share the "
I think you are right, we have to accept that it is not possible to use loadscript this way with the argument string having white spaces. Thank you for confirming/veryfying this, was breaking my head already for a few day.
For now i will try to make use of it by making sure the full name of my_scrpt.rvb contains no spaces this way i can make use of the this batch sequence. Will leave the development of another vbscript to bypass this procedure for another time.
Thank you all for the effort and contribution.
Regards,
JEA
This should do the trick.
I actually have some identical situation with AutoCAD: a batch File loads Autocad.exe, opens a specific template file ( *.dwt), and immediately runs a generic LISP file that know where the a specific VBA code is. I knew how to solve it in AutoCAD but was clueless in how to solve with with Rhino Command line. Now i see the same principle can be used.
Thanks a lot.