System
- mechanica.system
alias of
MxSystemPy
- class mechanica.MxSystem
Provides various methods to interact with the rendering engine and host CPU.
- subrenderer = <enum 'SubRendererFlags'>
Subrenderer flags
- static screenshot(filepath: str, decorate: Optional[bool] = None, bgcolor=None)
Save a screenshot of the current scene
- Parameters
filepath (str) – path of file to save
decorate (bool) – flag to decorate the scene in the screenshot
bgcolor (MxVector3f or [float, float, float] or (float, float, float) or float) – background color of the scene in the screenshot
- Return type
int
- Returns
HRESULT
- static cameraMoveTo(*args) HRESULT
Overload 1:
Set the camera view parameters
- Parameters
eye (
MxVector3f) – camera eyecenter (
MxVector3f) – view centerup (
MxVector3f) – view upward direction
- Return type
int
- Returns
HRESULT
Overload 2:
Set the camera view parameters
- Parameters
center (
MxVector3f) – target camera view center positionrotation (
MxQuaternionf) – target camera rotationzoom (float) – target camera zoom
- Return type
int
- Returns
HRESULT
- static cameraViewBottom() HRESULT
Move the camera to view the domain from the bottm
- Return type
int
- Returns
HRESULT
- static cameraViewTop() HRESULT
Move the camera to view the domain from the top
- Return type
int
- Returns
HRESULT
- static cameraViewLeft() HRESULT
Move the camera to view the domain from the left
- Return type
int
- Returns
HRESULT
- static cameraViewRight() HRESULT
Move the camera to view the domain from the right
- Return type
int
- Returns
HRESULT
- static cameraViewBack() HRESULT
Move the camera to view the domain from the back
- Return type
int
- Returns
HRESULT
- static cameraViewFront() HRESULT
Move the camera to view the domain from the front
- Return type
int
- Returns
HRESULT
- static cameraReset() HRESULT
Reset the camera
- Return type
int
- Returns
HRESULT
- static cameraTranslateDown() HRESULT
Translate the camera down
- Return type
int
- Returns
HRESULT
- static cameraTranslateUp() HRESULT
Translate the camera up
- Return type
int
- Returns
HRESULT
- static cameraTranslateRight() HRESULT
Translate the camera right
- Return type
int
- Returns
HRESULT
- static cameraTranslateLeft() HRESULT
Translate the camera left
- Return type
int
- Returns
HRESULT
- static cameraTranslateForward() HRESULT
Translate the camera forward
- Return type
int
- Returns
HRESULT
- static cameraTranslateBackward() HRESULT
Translate the camera backward
- Return type
int
- Returns
HRESULT
- static cameraRotateDown() HRESULT
Rotate the camera down
- Return type
int
- Returns
HRESULT
- static cameraRotateUp() HRESULT
Rotate the camera up
- Return type
int
- Returns
HRESULT
- static cameraRotateLeft() HRESULT
Rotate the camera left
- Return type
int
- Returns
HRESULT
- static cameraRotateRight() HRESULT
Rotate the camera right
- Return type
int
- Returns
HRESULT
- static cameraRollLeft() HRESULT
Roll the camera left
- Return type
int
- Returns
HRESULT
- static cameraRollRight() HRESULT
Rotate the camera right
- Return type
int
- Returns
HRESULT
- static cameraZoomIn() HRESULT
Zoom the camera in
- Return type
int
- Returns
HRESULT
- static cameraZoomOut() HRESULT
Zoom the camera out
- Return type
int
- Returns
HRESULT
- static cameraZoomBy(delta: float const &) HRESULT
Zoom the camera by an increment in distance.
Positive values zoom in.
- Parameters
delta (float) – zoom increment
- Return type
int
- Returns
HRESULT
- static cameraZoomTo(distance: float const &) HRESULT
Zoom the camera to a distance.
- Parameters
distance (float) – zoom distance
- Return type
int
- Returns
HRESULT
- static cameraRotateToAxis(axis: MxVector3f, distance: float const &) HRESULT
Rotate the camera to a point from the view center a distance along an axis.
Only rotates the view to the given eye position.
- Parameters
axis (
MxVector3f) – axis from the view centerdistance (float) – distance along the axis
- Return type
int
- Returns
HRESULT
- static cameraRotateToEulerAngle(angles: MxVector3f) HRESULT
Rotate the camera to a set of Euler angles.
Rotations are Z-Y-X.
- Parameters
angles (
MxVector3f) –- Return type
int
- Returns
HRESULT
- static cameraCenter() MxVector3f
Get the current camera view center position
- Return type
- Returns
MxVector3f
- static cameraRotation() MxQuaternionf
Get the current camera rotation
- Return type
- Returns
MxQuaternionf
- static cameraZoom() float
Get the current camera zoom
- Return type
float
- Returns
float
- static getAmbientColor() MxVector3f
Get the ambient color
- Return type
- Returns
MxVector3f
- static setAmbientColor(*args) HRESULT
Overload 1:
Set the ambient color
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
Overload 2:
Set the ambient color of a subrenderer
- Parameters
color (
MxVector3f) –srFlag (int) –
- Return type
int
- Returns
HRESULT
- static getDiffuseColor() MxVector3f
Get the diffuse color
- Return type
- Returns
MxVector3f
- static setDiffuseColor(*args) HRESULT
Overload 1:
Set the diffuse color
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
Overload 2:
Set the diffuse color of a subrenderer
- Parameters
color (
MxVector3f) –srFlag (int) –
- Return type
int
- Returns
HRESULT
- static getSpecularColor() MxVector3f
Get specular color
- Return type
- Returns
MxVector3f
- static setSpecularColor(*args) HRESULT
Overload 1:
Set the specular color
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
Overload 2:
Set the specular color of a subrenderer
- Parameters
color (
MxVector3f) –srFlag (int) –
- Return type
int
- Returns
HRESULT
- static getShininess() float
Get the shininess
- Return type
float
- Returns
float
- static setShininess(*args) HRESULT
Overload 1:
Set the shininess
- Parameters
shininess (float) –
- Return type
int
- Returns
HRESULT
Overload 2:
Set the shininess of a subrenderer
- Parameters
shininess (float) –
srFlag (int) –
- Return type
int
- Returns
HRESULT
- static getGridColor() MxVector3f
Get the grid color
- Return type
- Returns
MxVector3f
- static setGridColor(color: MxVector3f) HRESULT
Set the grid color
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
- static getSceneBoxColor() MxVector3f
Get the scene box color
- Return type
- Returns
MxVector3f
- static setSceneBoxColor(color: MxVector3f) HRESULT
Set the scene box color
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
- static getLightDirection() MxVector3f
Get the light direction
- Return type
- Returns
MxVector3f
- static setLightDirection(*args) HRESULT
Overload 1:
Set the light direction
- Parameters
lightDir (
MxVector3f) –- Return type
int
- Returns
HRESULT
Overload 2:
Set the light direction of a subrenderer
- Parameters
lightDir (
MxVector3f) –srFlag (int) –
- Return type
int
- Returns
HRESULT
- static getLightColor() MxVector3f
Get the light color
- Return type
- Returns
MxVector3f
- static setLightColor(*args) HRESULT
Overload 1:
Set the light color
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
Overload 2:
Set the light color of a subrenderer
- Parameters
color (
MxVector3f) –srFlag (int) –
- Return type
int
- Returns
HRESULT
- static decorated() bool
Test whether the rendered scene is decorated
- Return type
boolean
- Returns
true
- Return type
boolean
- Returns
false
- static decorateScene(decorate: bool const &) HRESULT
Set flag to draw/not draw scene decorators (e.g., grid)
- Parameters
decorate (boolean) – flag; true says to decorate
- Return type
int
- Returns
HRESULT
- static showingDiscretization() bool
Test whether discretization is current shown
- Return type
boolean
- Returns
true
- Return type
boolean
- Returns
false
- static showDiscretization(show: bool const &) HRESULT
Set flag to draw/not draw discretization
- Parameters
show (boolean) – flag; true says to show
- Return type
int
- Returns
HRESULT
- static getDiscretizationColor() MxVector3f
Get the current color of the discretization grid
- Return type
- Returns
MxVector3f
- static setDiscretizationColor(color: MxVector3f) HRESULT
Set the color of the discretization grid
- Parameters
color (
MxVector3f) –- Return type
int
- Returns
HRESULT
- static cpu_info() dict
Dictionary of CPU info
- static compile_flags() dict
Dictionary of compiler flags
- static gl_info() dict
Dictionary of OpenGL info
- static egl_info() std::string
Get EGL info
- Return type
string
- Returns
std::string
- class mechanica.MxSystemPy
Bases:
MxSystem- static is_terminal_interactive() bool
Test whether Mechanica is running in an interactive terminal
- Return type
boolean
- Returns
true if running in an interactive terminal
- Return type
boolean
- Returns
false
- static is_jupyter_notebook() bool
Test whether Mechanica is running in a Jupyter notebook
- Return type
boolean
- Returns
true if running in a Jupyter notebook
- Return type
boolean
- Returns
false