start python script in blender from Java

General discussion about the development of the open source Blender

Moderators: jesterKing, stiv

Post Reply
armandokengne
Posts: 0
Joined: Mon Aug 19, 2013 2:25 pm

start python script in blender from Java

Post by armandokengne » Mon Aug 19, 2013 2:41 pm

Hello!!
please how can I start python script in blender from Java. Some short Script or code example please.

Thank you

Armand

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Mon Aug 19, 2013 7:49 pm

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.

armandokengne
Posts: 0
Joined: Mon Aug 19, 2013 2:25 pm

Post by armandokengne » Mon Aug 19, 2013 10:35 pm

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

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv » Wed Aug 21, 2013 2:05 am

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.

Post Reply