Skip to main content

Application

Core

The root application class for the Scripting API.

Import​

import ScriptingApi as api

# Create application instance
app = api.Application()

Methods​

Properties​

get_version​

Retrieves the version string.

Signature:

get_version() -> str

Returns: str — A string representing the version.


get_project_file_path​

Retrieves the file path of the currently opened project.

Signature:

get_project_file_path() -> str

Returns: str — A string representing the file path of the currently opened project.


set_volumes_visible​

Sets the visibility state of specified volume objects.

Signature:

set_volumes_visible(volumeNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
volumeNameslistA list containing the names of the volumes to modify.
visibleboolIf true, makes the volumes visible; if false, hides them.

toggle_volumes_visible​

Inverts the visibility of specified volume objects. Each volume that is visible is hidden and each volume that is hidden is shown, as one step.

Signature:

toggle_volumes_visible(volumeNames: list) -> None

Parameters:

ParameterTypeDescription
volumeNameslistA list containing the names of the volumes to invert.

isolate_volumes​

Isolates specified volumes by showing only those and hiding all others.

Signature:

isolate_volumes(volumeNames: list) -> None

Parameters:

ParameterTypeDescription
volumeNameslistA list containing the names of the volumes to isolate. If empty, shows all volumes.

set_active_volume​

Sets the active volume by its name. Active volume is the one that is in bold in the volume scene tree and used for certain operations.

Signature:

set_active_volume(volumeName: str) -> None

Parameters:

ParameterTypeDescription
volumeNamestrThe name of the volume to set as active.

get_active_volume_name​

Returns the name of the currently active volume.

Signature:

get_active_volume_name() -> str

Returns: str — The name of the currently active volume if any; otherwise, returns an empty string.


get_visible_volume_names​

Returns the names of visible volume objects in the current project.

Signature:

get_visible_volume_names() -> list

Returns: list — A list of strings containing the names of all visible volumes.


get_all_volume_names​

Returns the names of all volume objects in the current project.

Signature:

get_all_volume_names() -> list

Returns: list — A list of strings containing the names of all volumes.


set_masks_visible​

Sets the visibility state of specified mask objects.

Signature:

set_masks_visible(maskNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks to modify.
visibleboolIf true, makes the masks visible; if false, hides them.

toggle_masks_visible​

Inverts the visibility of specified mask objects. Each mask that is visible is hidden and each mask that is hidden is shown, as one step.

Signature:

toggle_masks_visible(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks to invert.

isolate_masks​

Isolates specified masks by showing only those and hiding all others.

Signature:

isolate_masks(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks to isolate. If empty, shows all masks.

set_active_mask​

Sets the active mask by its name. Active mask is the one that is in bold in the mask scene tree and used for certain operations.

Signature:

set_active_mask(maskName: str) -> None

Parameters:

ParameterTypeDescription
maskNamestrThe name of the mask to set as active.

get_active_mask_name​

Returns the name of the currently active mask.

Signature:

get_active_mask_name() -> str

Returns: str — The name of the currently active mask if any; otherwise, returns an empty string.


get_visible_mask_names​

Returns the names of visible mask objects in the current project.

Signature:

get_visible_mask_names() -> list

Returns: list — A list of strings containing the names of all visible masks.


get_all_mask_names​

Returns the names of all mask objects in the current project.

Signature:

get_all_mask_names() -> list

Returns: list — A list of strings containing the names of all masks.


set_surfaces_visible​

Sets the visibility state of specified surface objects.

Signature:

set_surfaces_visible(surfaceNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
surfaceNameslistA list containing the names of the surfaces to modify.
visibleboolIf true, makes the surfaces visible; if false, hides them.

toggle_surfaces_visible​

Inverts the visibility of specified surface objects. Each surface that is visible is hidden and each surface that is hidden is shown, as one step.

Signature:

toggle_surfaces_visible(surfaceNames: list) -> None

Parameters:

ParameterTypeDescription
surfaceNameslistA list containing the names of the surfaces to invert.

isolate_surfaces​

Isolates specified surfaces by showing only those and hiding all others.

Signature:

isolate_surfaces(surfaceNames: list) -> None

Parameters:

ParameterTypeDescription
surfaceNameslistA list containing the names of the surfaces to isolate. If empty, shows all surfaces.

set_active_surface​

Sets the active surface by its name. Active surface is the one that is in bold in the surface scene tree and used for certain operations.

Signature:

set_active_surface(surfaceName: str) -> None

Parameters:

ParameterTypeDescription
surfaceNamestrThe name of the surface to set as active.

get_active_surface_name​

Returns the name of the currently active surface.

Signature:

get_active_surface_name() -> str

Returns: str — The name of the currently active surface if any; otherwise, returns an empty string.


get_visible_surface_names​

Returns the names of visible surface objects in the current project.

Signature:

get_visible_surface_names() -> list

Returns: list — A list of strings containing the names of all visible surfaces.


get_all_surface_names​

Returns the names of all surface objects in the current project.

Signature:

get_all_surface_names() -> list

Returns: list — A list of strings containing the names of all surfaces.


set_volume_meshes_visible​

Sets the visibility state of specified volume mesh objects.

Signature:

set_volume_meshes_visible(volumeMeshNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameslistA list containing the names of the volume meshes to modify.
visibleboolIf true, makes the volume meshes visible; if false, hides them.

toggle_volume_meshes_visible​

Inverts the visibility of specified volume mesh objects. Each volume mesh that is visible is hidden and each volume mesh that is hidden is shown, as one step.

Signature:

toggle_volume_meshes_visible(volumeMeshNames: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameslistA list containing the names of the volume meshes to invert.

isolate_volume_meshes​

Isolates specified volume meshes by showing only those and hiding all others.

Signature:

isolate_volume_meshes(volumeMeshNames: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameslistA list containing the names of the volume meshes to isolate. If empty, shows all volume meshes.

set_active_volume_mesh​

Sets the active volume mesh by its name. Active volume mesh is the one that is in bold in the volume mesh scene tree and used for certain operations.

Signature:

set_active_volume_mesh(volumeMeshName: str) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamestrThe name of the volume mesh to set as active.

get_active_volume_mesh_name​

Returns the name of the currently active volume mesh.

Signature:

get_active_volume_mesh_name() -> str

Returns: str — The name of the currently active volume mesh if any; otherwise, returns an empty string.


get_visible_volume_mesh_names​

Returns the names of visible volume mesh objects in the current project.

Signature:

get_visible_volume_mesh_names() -> list

Returns: list — A list of strings containing the names of all visible volume meshes.


get_all_volume_mesh_names​

Returns the names of all volume mesh objects in the current project.

Signature:

get_all_volume_mesh_names() -> list

Returns: list — A list of strings containing the names of all volume meshes.


set_primitives_visible​

Sets the visibility state of specified primitive objects.

Signature:

set_primitives_visible(primitiveNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
primitiveNameslistA list containing the names of the primitives to modify.
visibleboolIf true, makes the primitives visible; if false, hides them.

toggle_primitives_visible​

Toggles the visibility of the specified primitives as one undoable action.

Signature:

toggle_primitives_visible(primitiveNames: list) -> None

Parameters:

ParameterTypeDescription
primitiveNameslistNames of the primitives to toggle. An empty list changes nothing.

isolate_primitives​

Isolates specified primitives by showing only those and hiding all others.

Signature:

isolate_primitives(primitiveNames: list) -> None

Parameters:

ParameterTypeDescription
primitiveNameslistA list containing the names of the primitives to isolate. If empty, shows all primitives.

set_active_primitive​

Sets the active primitive by its name. Active primitive is the one that is currently selected and used for certain operations.

Signature:

set_active_primitive(primitiveName: str) -> None

Parameters:

ParameterTypeDescription
primitiveNamestrThe name of the primitive to set as active.

get_active_primitive_name​

Returns the name of the currently active primitive.

Signature:

get_active_primitive_name() -> str

Returns: str — The name of the currently active primitive if any; otherwise, returns an empty string.


get_visible_primitive_names​

Returns the names of visible primitive objects in the current project.

Signature:

get_visible_primitive_names() -> list

Returns: list — A list of strings containing the names of all visible primitives.


get_all_primitive_names​

Returns the names of all primitive objects in the current project.

Signature:

get_all_primitive_names() -> list

Returns: list — A list of strings containing the names of all primitives.


set_analyses_visible​

Sets the visibility state of specified analysis objects.

Signature:

set_analyses_visible(analysisNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
analysisNameslistA list containing the names of the analyses to modify.
visibleboolIf true, makes the analyses visible; if false, hides them.

isolate_analyses​

Isolates specified analyses by showing only those and hiding all others.

Signature:

isolate_analyses(analysisNames: list) -> None

Parameters:

ParameterTypeDescription
analysisNameslistA list containing the names of the analyses to isolate. If empty, shows all analyses.

rename_analysis​

Renames an analysis object.

Signature:

rename_analysis(analysisName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
analysisNamestrThe current name of the analysis to rename.
newNamestrThe new name to assign to the analysis.

set_active_analysis​

Sets the active analysis by its name. Active analysis is the one that is currently selected and used for certain operations.

Signature:

set_active_analysis(analysisName: str) -> None

Parameters:

ParameterTypeDescription
analysisNamestrThe name of the analysis to set as active.

get_active_analysis_name​

Returns the name of the currently active analysis.

Signature:

get_active_analysis_name() -> str

Returns: str — The name of the currently active analysis if any; otherwise, returns an empty string.


get_visible_analysis_names​

Returns the names of visible analysis objects in the current project.

Signature:

get_visible_analysis_names() -> list

Returns: list — A list of strings containing the names of all visible analyses.


get_all_analysis_names​

Returns the names of all analysis objects in the current project.

Signature:

get_all_analysis_names() -> list

Returns: list — A list of strings containing the names of all analyses.


set_mask_3d_preview_quality​

Sets the quality level for 3D mask previews.

Signature:

set_mask_3d_preview_quality(quality: Mask3dPreviewQuality) -> None

Parameters:

ParameterTypeDescription
qualityMask3dPreviewQualityThe desired quality level for the 3D mask preview. Use api.Mask3dPreviewQuality.Optimal, api.Mask3dPreviewQuality.High, api.Mask3dPreviewQuality.Medium, or api.Mask3dPreviewQuality.Low.

get_mask_3d_preview_quality​

Retrieves the current mask preview quality setting.

Signature:

get_mask_3d_preview_quality() -> Mask3dPreviewQuality

Returns: Mask3dPreviewQuality — The current mask preview quality (e.g., api.Mask3dPreviewQuality.Medium).


get_volume_operations​

Returns an api.VolumeOperations object.

Signature:

get_volume_operations() -> VolumeOperations

Returns: VolumeOperations — The api.VolumeOperations object.


get_mask_operations​

Returns an api.MaskOperations object.

Signature:

get_mask_operations() -> MaskOperations

Returns: MaskOperations — The api.MaskOperations object.


get_surface_operations​

Returns an api.SurfaceOperations object.

Signature:

get_surface_operations() -> SurfaceOperations

Returns: SurfaceOperations — The api.SurfaceOperations object.


get_volume_mesh_operations​

Returns an api.VolumeMeshOperations object.

Signature:

get_volume_mesh_operations() -> VolumeMeshOperations

Returns: VolumeMeshOperations — The api.VolumeMeshOperations object.


get_fem_operations​

Returns an api.FemOperations object for finite element model operations.

Signature:

get_fem_operations() -> FemOperations

Returns: FemOperations — The api.FemOperations object for managing FEM models, materials, sets, and exports.


get_primitive_operations​

Returns an api.PrimitiveOperations object for primitive/ROI operations.

Signature:

get_primitive_operations() -> PrimitiveOperations

Returns: PrimitiveOperations — The api.PrimitiveOperations object for creating and managing 3D primitive shapes.


get_registration_operations​

Returns an api.RegistrationOperations object for global registration.

Signature:

get_registration_operations() -> RegistrationOperations

Returns: RegistrationOperations — The api.RegistrationOperations object providing access to registration functionality.


get_analysis_operations​

Returns an api.AnalysisOperations object for analysis operations.

Signature:

get_analysis_operations() -> AnalysisOperations

Returns: AnalysisOperations — The api.AnalysisOperations object providing access to analysis functionality.


get_ai_segmentation​

Returns an api.AiSegmentation object for AI-based medical image segmentation.

Signature:

get_ai_segmentation() -> AiSegmentation

Returns: AiSegmentation — The api.AiSegmentation object providing access to AI segmentation functionality.


get_view_operations​

Returns an api.ViewOperations object for views and rendering related operations.

Signature:

get_view_operations() -> ViewOperations

Returns: ViewOperations — The api.ViewOperations object providing access to layout, orientation, camera, representation, shading, and visualization operations.


get_preferences_operations​

Returns an api.PreferencesOperations object for reading and updating application preferences.

Signature:

get_preferences_operations() -> PreferencesOperations

Returns: PreferencesOperations — The api.PreferencesOperations object providing access to the application's preference values.


get_operation_log_operations​

Returns an api.OperationLogOperations object for reading the recorded history.

Signature:

get_operation_log_operations() -> OperationLogOperations

Returns: OperationLogOperations — The api.OperationLogOperations object providing read-only access to what the application recorded: listing actions, reporting what the history can say about itself, and writing it to a file. Calls made through it are not themselves recorded.


File System​

get_working_directory​

Retrieves the current working directory as a string.

Signature:

get_working_directory() -> str

Returns: str — A string representing the current working directory.


get_installation_directory​

Retrieves the installation directory of the application as a string.

Signature:

get_installation_directory() -> str

Returns: str — A string representing the installation directory.


save_project​

Saves the current project to the specified file path.

Signature:

save_project(filePath: str = "") -> bool

Parameters:

ParameterTypeDescription
filePathstrThe path to the file where the project should be saved. If empty, the current project will be saved to its existing path.

Returns: bool — true if the project was saved successfully; false otherwise.


save_snapshot_to_disk​

Captures a snapshot of the specified type and saves it to disk.

Signature:

save_snapshot_to_disk(snapshotType: SnapshotType, filePath: str, format: str = "PNG") -> bool

Parameters:

ParameterTypeDescription
snapshotTypeSnapshotTypeThe type of snapshot to capture. Use api.SnapshotType values (e.g., api.SnapshotType.Scene, api.SnapshotType.View3D).
filePathstrThe full path where the image will be saved.
formatstrThe image format (e.g., "PNG", "JPEG"). Defaults to "PNG".

Returns: bool — True if the image was saved successfully, false otherwise.


UI​

show_message_box​

Displays a message box with a specified text, title, and level. If the title is not specified, it defaults to "Information". If the level is not specified, it defaults to api.MsgBoxLevel.Info.

Signature:

show_message_box(text: str, title: str = "Information", level: MsgBoxLevel = api.MsgBoxLevel.Info) -> None

Parameters:

ParameterTypeDescription
textstrThe message text to display in the message box.
titlestrThe title to display on the message box title bar.
levelMsgBoxLevelThe level or type of the message box. Use api.MsgBoxLevel.Info, api.MsgBoxLevel.Warn, or api.MsgBoxLevel.Error.

show_question_message_box​

Displays a question message box with the specified text and title. If the title is not specified, it defaults to "Question".

Signature:

show_question_message_box(text: str, title: str = "Question") -> bool

Parameters:

ParameterTypeDescription
textstrThe message text to display in the question box.
titlestrThe title to display on the question box title bar.

Returns: bool — true if the user clicked "Yes", false otherwise.


set_message_box_suppression​

Sets how the application handles message boxes while the current script runs. A message box blocks the script until somebody clicks a button, which stalls an unattended run. Suppression lets the script keep going instead. A skipped message box is written to the application log, and a skipped question is answered with its default button. The setting applies to the current script run only. It is restored automatically when the script finishes, so a script cannot leave the application permanently silent.

Signature:

set_message_box_suppression(mode: MsgBoxSuppression) -> None

Parameters:

ParameterTypeDescription
modeMsgBoxSuppressionThe suppression mode. Use api.MsgBoxSuppression.Off, api.MsgBoxSuppression.Notifications, or api.MsgBoxSuppression.All.

get_message_box_suppression​

Returns the message box suppression mode currently in effect.

Signature:

get_message_box_suppression() -> MsgBoxSuppression

Returns: MsgBoxSuppression — The current mode (e.g., api.MsgBoxSuppression.Off).


Project Management​

open_project​

Opens a project from the specified file path.

Signature:

open_project(filePath: str) -> bool

Parameters:

ParameterTypeDescription
filePathstrThe path to the project file to open.

Returns: bool — true if the project was opened successfully; false otherwise.


close_project​

Closes the currently opened project.

Signature:

close_project() -> None

General​

undo​

Undoes the last action in the current project.

Signature:

undo() -> None

redo​

Redoes the last undone action in the current project.

Signature:

redo() -> None

duplicate_volumes​

Duplicates volume objects with the specified names.

Signature:

duplicate_volumes(volumeNames: list) -> list

Parameters:

ParameterTypeDescription
volumeNameslistA list containing the names of the volumes to duplicate.

Returns: list — A list of names for the duplicated volumes.


delete_volumes​

Deletes volume objects with the specified names.

Signature:

delete_volumes(volumeNames: list) -> bool

Parameters:

ParameterTypeDescription
volumeNameslistA list containing the names of the volumes to delete.

Returns: bool — true if all specified volumes were successfully deleted; false otherwise.


delete_all_volumes​

Deletes all volume objects, optionally displaying a message box.

Signature:

delete_all_volumes(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all volumes were successfully deleted; otherwise, false.


rename_volume​

Renames a volume object.

Signature:

rename_volume(volumeName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
volumeNamestrThe current name of the volume to rename.
newNamestrThe new name to assign to the volume.

duplicate_masks​

Duplicates mask objects with the specified names.

Signature:

duplicate_masks(maskNames: list) -> list

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks to duplicate.

Returns: list — A list of names for the duplicated masks.


delete_masks​

Deletes mask objects with the specified names.

Signature:

delete_masks(maskNames: list) -> bool

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks to delete.

Returns: bool — true if all specified masks were successfully deleted; false otherwise.


delete_all_masks​

Deletes all mask objects, optionally displaying a message box.

Signature:

delete_all_masks(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all masks were successfully deleted; otherwise, false.


rename_mask​

Renames a mask object.

Signature:

rename_mask(maskName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
maskNamestrThe current name of the mask to rename.
newNamestrThe new name to assign to the mask.

duplicate_surfaces​

Duplicates surface objects with the specified names.

Signature:

duplicate_surfaces(surfaceNames: list) -> list

Parameters:

ParameterTypeDescription
surfaceNameslistA list containing the names of the surfaces to duplicate.

Returns: list — A list of names for the duplicated surfaces.


delete_surfaces​

Deletes surface objects with the specified names.

Signature:

delete_surfaces(surfaceNames: list) -> bool

Parameters:

ParameterTypeDescription
surfaceNameslistA list containing the names of the surfaces to delete.

Returns: bool — true if all specified surfaces were successfully deleted; false otherwise.


delete_all_surfaces​

Deletes all surface objects, optionally displaying a message box.

Signature:

delete_all_surfaces(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all surfaces were successfully deleted; otherwise, false.


rename_surface​

Renames a surface object.

Signature:

rename_surface(surfaceName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
surfaceNamestrThe current name of the surface to rename.
newNamestrThe new name to assign to the surface.

duplicate_volume_meshes​

Duplicates volume mesh objects with the specified names.

Signature:

duplicate_volume_meshes(volumeMeshNames: list) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameslistA list containing the names of the volume meshes to duplicate.

Returns: list — A list of names for the duplicated volume meshes.


delete_volume_meshes​

Deletes volume mesh objects with the specified names.

Signature:

delete_volume_meshes(volumeMeshNames: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameslistA list containing the names of the volume meshes to delete.

Returns: bool — true if all specified volume meshes were successfully deleted; false otherwise.


delete_all_volume_meshes​

Deletes all volume mesh objects, optionally displaying a message box.

Signature:

delete_all_volume_meshes(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all volume meshes were successfully deleted; otherwise, false.


rename_volume_mesh​

Renames a volume mesh object.

Signature:

rename_volume_mesh(volumeMeshName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamestrThe current name of the volume mesh to rename.
newNamestrThe new name to assign to the volume mesh.

duplicate_primitives​

Duplicates primitive objects with the specified names.

Signature:

duplicate_primitives(primitiveNames: list) -> list

Parameters:

ParameterTypeDescription
primitiveNameslistA list containing the names of the primitives to duplicate.

Returns: list — A list of names for the duplicated primitives.


delete_primitives​

Deletes primitive objects with the specified names.

Signature:

delete_primitives(primitiveNames: list) -> bool

Parameters:

ParameterTypeDescription
primitiveNameslistA list containing the names of the primitives to delete.

Returns: bool — true if all specified primitives were successfully deleted; false otherwise.


delete_all_primitives​

Deletes all primitive objects, optionally displaying a message box.

Signature:

delete_all_primitives(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all primitives were successfully deleted; otherwise, false.


rename_primitive​

Renames a primitive object.

Signature:

rename_primitive(primitiveName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
primitiveNamestrThe current name of the primitive to rename.
newNamestrThe new name to assign to the primitive.

duplicate_analyses​

Duplicates analysis objects with the specified names.

Signature:

duplicate_analyses(analysisNames: list) -> list

Parameters:

ParameterTypeDescription
analysisNameslistA list containing the names of the analyses to duplicate.

Returns: list — A list of names for the duplicated analyses.


delete_analyses​

Deletes analysis objects with the specified names.

Signature:

delete_analyses(analysisNames: list) -> bool

Parameters:

ParameterTypeDescription
analysisNameslistA list containing the names of the analyses to delete.

Returns: bool — True if all specified analyses were successfully deleted; false otherwise.


delete_all_analyses​

Deletes all analysis objects, optionally displaying a message box.

Signature:

delete_all_analyses(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all analyses were successfully deleted; otherwise, false.


remove_mask_3d_preview​

Removes 3D mask previews corresponding to the specified mask names.

Signature:

remove_mask_3d_preview(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks whose 3D previews should be removed.

remove_all_mask_3d_previews​

Removes all mask 3D previews.

Signature:

remove_all_mask_3d_previews() -> None

grab_snapshot​

Captures a snapshot of the specified type and returns it as image data. This function captures a snapshot from the application, including options for capturing the full application window, the 3D scene, or specific view windows such as 2D slices (Right, Front, Top) or various 3D viewing angles.

Signature:

grab_snapshot(snapshotType: SnapshotType = api.SnapshotType.Scene) -> Image2D

Parameters:

ParameterTypeDescription
snapshotTypeSnapshotTypeThe type of snapshot to capture. Use api.SnapshotType values (e.g., api.SnapshotType.Scene, api.SnapshotType.View3D).

Returns: Image2D — A api.Image2D struct containing the captured image data (PNG-encoded bytes), width, height, and format. Raises an error if the snapshot could not be captured or encoded.


Analysis​

duplicate_measurements​

Duplicates measurement objects with the specified names.

Signature:

duplicate_measurements(measurementNames: list) -> list

Parameters:

ParameterTypeDescription
measurementNameslistA list containing the names of the measurements to duplicate.

Returns: list — A list of names for the duplicated measurements.


delete_measurements​

Deletes measurement objects with the specified names.

Signature:

delete_measurements(measurementNames: list) -> bool

Parameters:

ParameterTypeDescription
measurementNameslistA list containing the names of the measurements to delete.

Returns: bool — true if all specified measurements were successfully deleted; false otherwise.


delete_all_measurements​

Deletes all measurement objects, optionally displaying a message box.

Signature:

delete_all_measurements(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxboolIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all measurements were successfully deleted; otherwise, false.


set_measurements_visible​

Sets the visibility state of specified measurement objects.

Signature:

set_measurements_visible(measurementNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
measurementNameslistA list containing the names of the measurements to modify.
visibleboolIf true, makes the measurements visible; if false, hides them.

toggle_measurements_visible​

Toggles the visibility of the specified measurements as one undoable action.

Signature:

toggle_measurements_visible(measurementNames: list) -> None

Parameters:

ParameterTypeDescription
measurementNameslistNames of the measurements to toggle. An empty list changes nothing.

isolate_measurements​

Isolates specified measurements by showing only those and hiding all others.

Signature:

isolate_measurements(measurementNames: list) -> None

Parameters:

ParameterTypeDescription
measurementNameslistA list containing the names of the measurements to isolate. If empty, shows all measurements.

rename_measurement​

Renames a measurement object.

Signature:

rename_measurement(measurementName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
measurementNamestrThe current name of the measurement to rename.
newNamestrThe new name to assign to the measurement.

set_active_measurement​

Sets the active measurement by its name. Active measurement is the one that is currently selected and used for certain operations.

Signature:

set_active_measurement(measurementName: str) -> None

Parameters:

ParameterTypeDescription
measurementNamestrThe name of the measurement to set as active.

get_active_measurement_name​

Returns the name of the currently active measurement.

Signature:

get_active_measurement_name() -> str

Returns: str — The name of the currently active measurement if any; otherwise, returns an empty string.


get_visible_measurement_names​

Returns the names of visible measurement objects in the current project.

Signature:

get_visible_measurement_names() -> list

Returns: list — A list of strings containing the names of all visible measurements.


get_all_measurement_names​

Returns the names of all measurement objects in the current project.

Signature:

get_all_measurement_names() -> list

Returns: list — A list of strings containing the names of all measurements.


get_measurement_operations​

Returns an api.MeasurementOperations object.

Signature:

get_measurement_operations() -> MeasurementOperations

Returns: MeasurementOperations — The api.MeasurementOperations object.


get_measure_operations​

Returns an api.MeasureOperations object for statistics and measurement operations.

Signature:

get_measure_operations() -> MeasureOperations

Returns: MeasureOperations — The api.MeasureOperations object providing access to statistics, histograms, mesh quality, and measurement functionality.


Creation​

generate_mask_3d_preview​

Generates 3D previews for the specified masks.

Signature:

generate_mask_3d_preview(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNameslistA list containing the names of the masks for which to generate 3D previews.

See Also​