RA3DWindow
Last update: 23.02.2026class RA3DWindow
3D window API.
Methods:
| Name | Description |
|---|---|
ApplyGridFunctionToAll(grid_function_name) |
Change the coloring of all entities in this window to the specified grid function. :param grid_function_name: The name of the grid function to be shown. It is possible to pass None to set back to solid color. |
CloseWindow() |
Removes this window from the application. |
CreateAnimationKeyFrame([number_of_frames]) |
Creates an animation key frame based on the current camera in the 3d window. |
ExportAnimation(filename[, mode]) |
|
GetActiveSimulation() |
|
GetAnimationKeyFramesCount() |
|
GetCamera() |
Get the API wrapper for the 3D window's camera. |
GetSize() |
|
Hide(name[, model_name]) |
Alias for SetVisible(False, name, model_name) . |
HideEdges([name, model_name]) |
Alias for SetEdgesVisible(False, name, model_name) . |
HideNodes([name, model_name]) |
Alias for SetNodesVisible(False, name, model_name) . |
RemoveAllAnimationKeyFrames() |
Removes all the currently created animation key frames in the current 3d window. |
Resize(width, height) |
Resize the 3D window to the given width and height. |
SetActiveSimulation(simulation_name) |
Changes the simulation being shown in the current 3D window |
SetAnimationCameraInterpolation(interpolation) |
|
SetAnimationFPS(fps) |
Sets the FPS (frames per second) to be used for the animation. |
SetBackgroundColor(color) |
|
SetCameraPreset([preset]) |
Set the camera to one of the existing presets. |
SetEdgesVisible(visible[, name, model_name]) |
Makes the edges visible or invisible in this window (changes either the global settings for this window or the the passed grid, if the grid is not using the global settings). |
SetForegroundColor(color) |
|
SetNodesVisible(visible[, name, model_name]) |
Makes the nodes visible or invisible in this window (changes either the global settings for this window or the the passed grid, if the grid is not using the global settings). |
SetSelectedWindow([window_name]) |
Sets the given window as the currently selected window. |
SetTransparency(transparency[, name, ...]) |
Sets the transparency for the given grid. |
SetVisible(visible, name[, model_name]) |
Makes a given element visible or invisible within this window. |
Show(name[, model_name]) |
Alias for SetVisible(True, name, model_name) . |
ShowEdges([name, model_name]) |
Alias for SetEdgesVisible(True, name, model_name) . |
ShowGeometryGridFunction(grid_function_name) |
Change the coloring of all geometries in this window to the specified grid function. :param grid_function_name: The name of the grid function to be shown. It is possible to pass None to set back to solid color. |
ShowGridFunction(**kwargs) |
|
ShowMaximized() |
Maximize the window, making it fill the entire screen space. |
ShowMinimized() |
Minimize the window, effectively hiding it from view and placing it in the taskbar |
ShowModel([model_name]) |
This function will activate the passed model. |
ShowNodes([name, model_name]) |
Alias for SetNodesVisible(True, name, model_name) . |
ShowNormal() |
Restore the window to its normal size, which is neither minimized nor maximized. |
ShowParticleGridFunction(grid_function_name) |
Change the particle coloring to the specified grid function. :param grid_function_name: The name of the grid function to be shown. It is possible to pass None to set back to solid color. |
ShowSphGridFunction(grid_function_name) |
Change the SPH coloring to the specified grid function. :param grid_function_name: The name of the grid function to be shown. It is possible to pass None to set back to solid color. |
Snapshot(filename[, width, height, ...]) |
Take a snapshot from the window content and save it in the filename given. |
Attributes:
| Name |
|---|
app |
ApplyGridFunctionToAll(grid_function_name: str | None)
Change the coloring of all entities in this window to the specified grid function. :param grid_function_name:
> The name of the grid function to be shown. > It is possible to pass None to set back to solid color.
CloseWindow()
Removes this window from the application.
CreateAnimationKeyFrame(number_of_frames=None)
Creates an animation key frame based on the current camera in the 3d window.
ExportAnimation(filename, mode='video')
- Parameters:
- filename (str) – The file to which the animation should be exported. If a video, the file will be the actual path passed, if exporting as images will
- mode (str) – Whether the animation should be exported as a video or as images. Accepted values: ‘video’, ‘images’.
GetActiveSimulation()
- Return type: unicode
- Returns: The name of the simulation being shown
GetAnimationKeyFramesCount()
- Return int: Returns the number of key frames created for the given 3d window.
GetCamera()
Get the API wrapper for the 3D window’s camera.
- Return type: KACamera
GetSize()
- Return type: tuple(int, int)
- Returns: Returns the client window dimension (width, height)
Hide(name, model_name=None)
Alias for SetVisible(False, name, model_name) .. seealso:: SetVisible
HideEdges(name=None, model_name=None)
Alias for SetEdgesVisible(False, name, model_name) .. seealso:: SetEdgesVisible
HideNodes(name=None, model_name=None)
Alias for SetNodesVisible(False, name, model_name) .. seealso:: SetNodesVisible
RemoveAllAnimationKeyFrames()
Removes all the currently created animation key frames in the current 3d window.
Resize(width, height)
Resize the 3D window to the given width and height.
SetActiveSimulation(simulation_name)
Changes the simulation being shown in the current 3D window
- Parameters: simulation_name (unicode) – The name of the simulation
SetAnimationCameraInterpolation(interpolation)
-
Parameters: interpolation (str) –
The interpolation method to be used to interpolate camera parameters.
Valid values are: : ’linear’ ‘spline’ ‘no-interpolation’
SetAnimationFPS(fps)
Sets the FPS (frames per second) to be used for the animation.
Note that the time for the animation is based on the total number of frames and the FPS, so, if there are 10 frames with an FPS of 2, the total time for the animation will be 5 seconds as each second will have 2 frames.
- Parameters: fps (int) – The fps to be used for the animation.
SetBackgroundColor(color)
- Parameters: color (tuple *(*int , int , int ) , tuple *(*float , float , float ) , unicode , int) – The color to be used as a background. Either a tuple with values 0..255, or a tuple with values 0..1, the name of the color or the RGB value as an integer.
SetCameraPreset(preset='+X')
Set the camera to one of the existing presets.
-
Parameters: preset (unicode) –
The preset to be set. The valid presets are: > - ’+X’ > - ’-X’ > - ’+X 30’ > - ’+Y’ > - ’-Y’ > - ’+Y 30’ > - ’+Z’ > - ’-Z’
SetEdgesVisible(visible, name=None, model_name=None)
Makes the edges visible or invisible in this window (changes either the global settings for this window or the the passed grid, if the grid is not using the global settings).
- Parameters:
- visible (bool) – Whether the edges should be made visible or invisible.
- name (unicode) – The name of the grid which should have the edges made visible or invisible. If not passed, changes the configuration of the global window settings.
- model_name (unicode) – The name of the model which has the grid which should have the edges made visible or invisible.
SetForegroundColor(color)
- Parameters: color (tuple *(*int , int , int ) , tuple *(*float , float , float ) , unicode , int) – The color to be used as a foreground. Either a tuple with values 0..255, or a tuple with values 0..1, the name of the color or the RGB value as an integer.
SetNodesVisible(visible, name=None, model_name=None)
Makes the nodes visible or invisible in this window (changes either the global settings for this window or the the passed grid, if the grid is not using the global settings).
- Parameters:
- visible (bool) – Whether the nodes should be made visible or invisible.
- name (unicode) – The name of the grid which should have the nodes made visible or invisible. If not passed, changes the configuration of the global window settings.
- model_name (unicode) – The name of the model which has the grid which should have the nodes made visible or invisible.
SetSelectedWindow(window_name=None)
Sets the given window as the currently selected window.
- Parameters: window_name (unicode) – The name of the window that should be selected (if not passed, the window which has this method called is selected).
SetTransparency(transparency, name=None, model_name=None, enable_transparency=True)
Sets the transparency for the given grid.
- Parameters:
- transparency (int) – A number between 0 and 100, where 0 is completely transparent and 100 is completely opaque.
- name (unicode) – The name of the grid which should have the transparency changed.
- model_name (unicode) – The name of the model which has the grid which should have the nodes made visible or invisible.
- enable_transparency (bool) – Whether the transparency set should be used or not in the given grid.
SetVisible(visible, name, model_name=None)
Makes a given element visible or invisible within this window.
- Parameters:
- visible (bool) – Whether the element should be made visible or invisible.
- name (unicode) – The name of the element to be made visible or invisible.
- model_name (unicode) – The model where the element is contained (if not passed, the current model is used).
Show(name, model_name=None)
Alias for SetVisible(True, name, model_name) .. seealso:: SetVisible
ShowEdges(name=None, model_name=None)
Alias for SetEdgesVisible(True, name, model_name) .. seealso:: SetEdgesVisible
ShowGeometryGridFunction(grid_function_name: str | None)
Change the coloring of all geometries in this window to the specified grid function. :param grid_function_name:
> The name of the grid function to be shown. > It is possible to pass None to set back to solid color.
ShowGridFunction(**kwargs: object)
- Parameters: grid_function_name – The grid_function_name of the grid function to be shown.
ShowMaximized()
Maximize the window, making it fill the entire screen space.
ShowMinimized()
Minimize the window, effectively hiding it from view and placing it in the taskbar
ShowModel(model_name=None)
This function will activate the passed model.
- Parameters: model_name (unicode) – The name of the model that should be activated.
ShowNodes(name=None, model_name=None)
Alias for SetNodesVisible(True, name, model_name) .. seealso:: SetNodesVisible
ShowNormal()
Restore the window to its normal size, which is neither minimized nor maximized.
ShowParticleGridFunction(grid_function_name: str | None)
Change the particle coloring to the specified grid function. :param grid_function_name:
> The name of the grid function to be shown. > It is possible to pass None to set back to solid color.
ShowSphGridFunction(grid_function_name: str | None)
Change the SPH coloring to the specified grid function. :param grid_function_name:
> The name of the grid function to be shown. > It is possible to pass None to set back to solid color.
Snapshot(filename, width=None, height=None, magnification=None, keep_aspect_ratio=None)
Take a snapshot from the window content and save it in the filename given.
- Parameters:
- filename (unicode) – The file name to save the snapshot. .. note:: the filename must contain the extension. e.g.: ‘../snapshot.png’
- width (int) – The snapshot width (only used for plots, not 3d windows). .. note:: the current window width is used if it is None
- height (int) – The snapshot height (only used for plots, not 3d windows). .. note:: the current window height is used if it is None
- magnification (int) – An int value to multiply the snapshot size. .. note:: if this parameter is specified, the width and height parameters are ignored.
- keep_aspect_ratio (bool) – Only used for plots, not 3d windows. If True the current plot size is scaled to a rectangle as large as possible inside a given rectangle (defined by the size given), keeping the aspect ratio.
property app
- Return type: KAApplication
- Returns: The application