Page 1 of 1

start python script in blender from Java

Posted: Mon Aug 19, 2013 2:41 pm
by armandokengne
please how can I start python script in blender from Java. Some short Script or code example please.

Thank you


Posted: Mon Aug 19, 2013 7:49 pm
by stiv
Just spawn off a process by whatever the Java equivalent of the system() call is. Doing 'blender -h' will give you the command line switches.

Posted: Mon Aug 19, 2013 10:35 pm
by armandokengne
hi stiv!!
thank you !! but I do not understand exactly what you mean, can you give me an example. Sorry, I am not a programming-expert

Thank you

Posted: Wed Aug 21, 2013 2:05 am
by stiv
I don't have a Java example for you since I am forbidden from Java coding by the court's restraining order. However most languages have some implementation of the C language system() call. It basically looks like this:

system("some program to run")

The stuff that goes into the "some program to run string" is essentially what you would type in at the command line to accomplish a given task.

A Python version would look like this:

Code: Select all

import os
os.system("blender --python path_to_some_py_script"
Doing it in Java is left as an exercise for the Reader, as they say.