Everything related to Maxwell Render and general stuff that doesn't fit in other categories.
By luis.hijarrubia
#395133
I recommend to change to PyMaxwell, witch also es better documented (for example, pressing F1 on Cmaxwell word will open a window with all functions and there it is a getCamerasCount method), but mainly because the "javascript" intepreter on maxwell.exe is provided by QT and it's deprecated, so on next QT version will disappear and it will disappear from maxwell too.
User avatar
By seghier
#395138
luis.hijarrubia wrote:
Mon Aug 21, 2017 10:52 am
I recommend to change to PyMaxwell, witch also es better documented (for example, pressing F1 on Cmaxwell word will open a window with all functions and there it is a getCamerasCount method), but mainly because the "javascript" intepreter on maxwell.exe is provided by QT and it's deprecated, so on next QT version will disappear and it will disappear from maxwell too.
in pymaxwell : getCamerasCount() but no clear explanation how to use it
Help on method Cmaxwell_getCamerasCount in module _pymaxwell4:
Cmaxwell_getCamerasCount(...) unbound pymaxwell.Cmaxwell method
Method: getCamerasCount() -> (int,ok)
Description: Returns the number of cameras in the scene
User avatar
By Mihai
#395139
Well, a course in Python is beyond the scope of the pymaxwell docs. I guess you would assign the value it returns to a variable. Something like:

yourscene = Cmaxwell(mwcallback);
yourscene.readMXS('myscene.mxs');

nrofcams = yourscene.getCamerasCount();

(I have next to no knowledge on python, so please no further questions 8) )
User avatar
By seghier
#395140
thanks Mihai
i create this but always an error ( question not for you :D )

from pymaxwell import *
scene = Cmaxwell(mwcallback);
scene.readMXS('c:/input/t.mxs');
nrofcams = 'c:/input/t.mxs'.getCamerasCount();

Traceback (most recent call last):
File "<string>", line 8, in <module>
AttributeError: 'str' object has no attribute 'getCamerasCount'
User avatar
By Mihai
#395141
You would use scene.getCameraCount() I think, not the name of the scene file again. "scene" effectively becomes whatever you've already specified with the scene.readMXS method. From then on, you use all the methods available to the "scene" object, it is implied that this object refers to "t.mxs".
User avatar
By seghier
#395143
this is the script , thanks for help:

from pymaxwell import *
scene = Cmaxwell(mwcallback);
scene.readMXS('mxs location');
print scene.getCamerasCount()
or
from pymaxwell import *
scene = Cmaxwell(mwcallback);
scene.readMXS('mxs location');
value = scene.getCamerasCount();
print value

the result : (3, True) { 3 : cameras number } ; how i can choose the number only ?
can script in maxwell render use script from pymaxwell ?
User avatar
By seghier
#395144
the script {run_maxwell_render.py} always give error :
MAXWELL3_ROOT environment variable not found!
Traceback (most recent call last):
File "<string>", line 29, in <module>
File "<string>", line 23, in run_maxwell_render
File "C:\Program Files\Next Limit\Maxwell Render 4\python\python\lib\site-packages\pymaxwell\__init__.py", line 127, in runMaxwell
parameters.insert(0,mwroot+'/maxwell.exe');
UnboundLocalError: local variable 'mwroot' referenced before assignment
User avatar
By seghier
#395156
thanks Luis
the question about the code ?
//code to get the camera you want
i create code to count cameras number and separate them by name or number
and i want know how i can render each camera view ; this is simple in maxwell render script
Code: Select all
from pymaxwell import *

scene = Cmaxwell(mwcallback);
scene.readMXS('c:/input/maison.mxs')

### cameras number ###
n,ok = scene.getCamerasCount()
print (n);

### cameras name  ####
list = scene.getCameraNames()
print (list)
for o in (list):
    print (o)


### cameras ID  #######
r = range(n)
print (r)
for o in reversed(r):
    print(o)

Well.....they must have been proven wrong, as it's[…]

Hello dear customers, We have just released a new[…]

the render does not start

Also open the Console and read through it to see i[…]

Sketchup 2024 Released

I would like to add my voice to this annual reques[…]