Skip to main content

VolumeMeshOperations

Operations

Provides tools for creating, editing, and analyzing 3D volume mesh objects. Supports import/export, geometric transformation, and conversion between volume mesh and surface data.

Import

import ScriptingApi as api

# Access via Application
app = api.Application()
ops = app.get_volume_mesh_operations()

Methods

Properties

get_fem_operations

Returns a FemOperations object for finite element model operations.

Signature:

get_fem_operations() -> FemOperations

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


get_render_properties_operations

Returns a VolumeMeshRenderPropertiesOperations object.

Signature:

get_render_properties_operations() -> VolumeMeshRenderPropertiesOperations

Returns: VolumeMeshRenderPropertiesOperations — A VolumeMeshRenderPropertiesOperations object.


File System

import_volume_meshes_from_disk

Imports volume mesh files from disk.

Signature:

import_volume_meshes_from_disk(fileNames: list) -> list

Parameters:

ParameterTypeDescription
fileNamesanyA list containing the full paths of the volume mesh files to import. Supported file extensions are: vtu, vtk.

Returns: list — A list of strings containing the names of the imported volume mesh objects. An empty list is returned if no files were imported successfully.


import_volume_mesh_from_disk

Imports a volume mesh file from disk.

Signature:

import_volume_mesh_from_disk(fileName: str) -> str

Parameters:

ParameterTypeDescription
fileNameanyThe full path of the volume mesh file to import. Supported file extensions are: vtu, vtk.

Returns: str — Returns the name of the imported volume mesh object if successful; otherwise, returns an empty string.


export_volume_meshes_to_disk

Exports volume meshes specified by their names to disk files in a given directory with a specified file extension.

Signature:

export_volume_meshes_to_disk(volumeMeshNames: list, directoryPath: str, fileExtension: str, isASCII: bool = False) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNamesanyA list containing the names of the volume meshes to export.
directoryPathanyThe path to the directory where the volume mesh files will be saved.
fileExtensionanyThe file extension to use for the exported volume mesh files. Supported file extensions are: vtu, vtk.
isASCIIanyIf true, exports the files in ASCII format; otherwise, exports in binary format. Defaults to false. isASCII is applicable for both vtu and vtk file formats.

Returns: bool — Returns true if all volume meshes were successfully exported; otherwise, returns false.


export_volume_mesh_to_disk

Exports a volume mesh to a file on disk.

Signature:

export_volume_mesh_to_disk(volumeMeshName: str, fileName: str, isASCII: bool = False) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh to export.
fileNameanyThe path and name of the file to write the volume mesh data to. Supported file extensions are: vtu, vtk. File name should include the file extension, e.g., 'C:/temp/volume-mesh.vtu'.
isASCIIanyIf true, exports the volume mesh in ASCII format; otherwise, exports in binary format. Defaults to false. isASCII is applicable for both vtu and vtk file formats.

Returns: bool — True if the export was successful; false otherwise.


Modification

rotate

Rotates volume meshes around a specified axis and center point.

Signature:

rotate(volumeMeshNames: list, angleDegrees: float, axis: list, center: list = [0.0, 0.0, 0.0], aroundObjectCentroid: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyList of volume mesh names to rotate.
angleDegreesanyRotation angle in degrees.
axisanyRotation axis [x, y, z].
centeranyRotation center point [x, y, z] (ignored if aroundObjectCentroid=True).
aroundObjectCentroidanyIf true, rotates around object's bounding box centroid.

translate

Translates volume meshes by a specified vector.

Signature:

translate(volumeMeshNames: list, translation: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyList of volume mesh names to translate.
translationanyTranslation vector [x, y, z] in model units.

scale

Scales volume meshes by specified factors along each axis.

Signature:

scale(volumeMeshNames: list, scaleFactors: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyList of volume mesh names to scale.
scaleFactorsanyScale factors [x, y, z].

transform

Applies a transformation matrix to the specified volume meshes.

Signature:

transform(volumeMeshNames: list, matrix: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyList of volume mesh names to transform.
matrixanyTransformation matrix [16 elements].

General

mirror

Mirrors volume meshes across specified axes.

Signature:

mirror(volumeMeshNames: list, mirrorX: bool = False, mirrorY: bool = False, mirrorZ: bool = False) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyList of volume mesh names to mirror.
mirrorXanyMirror across X axis.
mirrorYanyMirror across Y axis.
mirrorZanyMirror across Z axis.

move_to_active_volume_center

Moves volume meshes to the center of the active volume image.

Signature:

move_to_active_volume_center(volumeMeshNames: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyList of volume mesh names to move.

convert_to_surfaces

Converts volume meshes to surface objects by extracting their outer surfaces.

Signature:

convert_to_surfaces(volumeMeshNames: list) -> list

Parameters:

ParameterTypeDescription
volumeMeshNamesanyA list containing the names of the volume meshes to convert.

Returns: list — A list of names for the created surface objects.


See Also