deadalvs wrote:hi, nope, not calling it from itself.. externally [ using Jython from within CityEngine ].
The right way to run python scripts that uses the PyMaxwell module is copying it in your platform python folder for external packages. The bad news are that CitiBuilder uses Python 2.5, and we support only 2.6 and above. So it seems that the only way to run scripts that uses the PyMaxwell python module is calling an external interpreter. Calling pymaxwell.exe is a good idea, but pymaxwell.exe is not concibed to be runned from external applications, so it doesn't return the result of the script after running it (and it may fail sometimes).
You can try calling python.exe instead of pymaxwell.exe that way:
import subprocess
app = "C:/Python26/python.exe"
file = "D:/DATA/../myFile.py"
subprocess.call([app, file])
To do that, you must install Python 2.6 (if you don't have it,
http://www.python.org/download/releases/2.6.6/), and copy the files pymaxwell.py and _pymaxwell.pyd from here:
C:\Program Files\Next Limit\Maxwell 2\python\pymaxwell\python2.6
to here:
C:\Python26\Lib\site-packages
Both Maxwell and Python must be 32-bits or 64-bits, no mixing!
deadalvs wrote:but a runScript() function would be cool, of course !
I've just realized that python 2 have a function that do that: execfile(scriptfilename);
deadalvs wrote:can you give me a hint then on the following :
I guess currently, it is then impossible to create any script which imports a series of obj files in Studio and then assigns a specified referenced material ?
The only way to do that for now is implementing a python script that opens the .mxs scene, creates a new object (Cmaxwell::createMesh(..)), and populate it with the geometry readed from the .obj file using the following methods: CmaxwellObject::setVertex(...), CmaxwellObject::setTriangle(...), CmaxwellObject::setNormal(...). Is not an easy