Python scripting from CLI

2208
6
Jump to solution
12-09-2013 10:18 PM
CristianoPedersini
New Contributor
Hello everybody,

I'm new to CityEngine, I started playing around with the python scripting interface. I was wondering if it is possible to use the same python scripting interface and CE functionalities from outside CityEngine, so without starting the application GUI. I would like to just run my scripts automatically from a Unix console, on a computer where I installed CE. Is that possible? Is there any ready-to-use interface for that?
My final goal is that of completely automatize the process of downloading GIS info from OSM, creating my 3D city and exporting it, without using the CE GUI.
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor II
Hi,

there's a startup.py script for such cases. check the python docs in the chapter 'special scripts'.

there, you can add any python code you need to run directly at startup.

ok ?

m.

View solution in original post

0 Kudos
6 Replies
MatthiasBuehler1
Frequent Contributor II
Hi,


this is currently not possible. you need to run an instance of CityEngine for these tasks.

would be nice of course.

the closest thing possible for this is to run an instance of CE and work with listeners.

ok ?

matt
0 Kudos
CristianoPedersini
New Contributor
Hi,

thank you for your response! Can you give me some more detailed hints? Are you talking about using Java event listeners? Don't I need the CityEngine GUI code for this approach?

Thank you.
0 Kudos
MatthiasBuehler1
Frequent Contributor II
I was talking about Python event listeners.

I don't really have experience with this, it's just something that one of my coworkers set up quite some time ago to check some things. Rather a hack, of course. But yes, you need CE started ( the GUI ). There's no way around this.

You could try the same thing with ArcGIS, using the CityEngine GP tool, would that be an option ? ( basically aggregating the data in ArcGIS and generate the geometries in there )

m.
0 Kudos
CristianoPedersini
New Contributor
Ok, of course I don't have any problem about starting CE GUI first.
Anyway, if I can just setup a default script to be launched after the CE startup, that would be enough for me.
Is there any configuration option like that? Maybe I can use the underlying OSGI framework?

Sticking with CE will be the best option for me right now. In the worst case scenario I can use xdtool to simulate the F9 key event and run the python script.

Cristiano
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi,

there's a startup.py script for such cases. check the python docs in the chapter 'special scripts'.

there, you can add any python code you need to run directly at startup.

ok ?

m.
0 Kudos
CristianoPedersini
New Contributor
OK I got it! works.
Thank you very much!

Cristiano
0 Kudos