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 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_render_properties_operations​

Returns a VolumeMeshRenderPropertiesOperations object.

Signature:

get_render_properties_operations() -> VolumeMeshRenderPropertiesOperations

Returns: VolumeMeshRenderPropertiesOperations — A VolumeMeshRenderPropertiesOperations object.


get_geometry_data​

Returns the volume mesh geometry as vertices, flat cell connectivity, and optional RGB color arrays. Use cellSizes and cellTypes together to split cellConnectivity into individual cells.

Signature:

get_geometry_data(volumeMeshName: str) -> VolumeMeshGeometryData

Parameters:

ParameterTypeDescription
volumeMeshNamestrThe name of the volume mesh to read.

Returns: VolumeMeshGeometryData — The api.VolumeMeshGeometryData object containing the mesh geometry and any available vertex or cell colors.


set_geometry_data​

Replaces the volume mesh geometry using vertices, flat cell connectivity, and optional RGB color arrays. Cell indices are validated before any change is applied. cellSizes and cellTypes must match one another and must fully describe cellConnectivity.

Signature:

set_geometry_data(volumeMeshName: str, geometryData: VolumeMeshGeometryData) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamestrThe name of the volume mesh to update.
geometryDataVolumeMeshGeometryDataVolume mesh geometry to apply. Create using api.VolumeMeshGeometryData().

File System​

import_volume_meshes_from_disk​

Imports volume mesh files from disk. The format is detected from each file's extension / content, and any FEM model the file contains (materials, sets, surfaces, parts) is attached to the imported volume mesh.

Signature:

import_volume_meshes_from_disk(fileNames: list) -> list

Parameters:

ParameterTypeDescription
fileNameslistA list containing the full paths of the volume mesh files to import. Supported formats: VTK (.vtu, .vtk), Abaqus / CalculiX (.inp), Nastran (.bdf, .nas), LS-DYNA (.k, .dyn, .key), ANSYS (.cdb), Gmsh (.msh), Fluent (.msh), and OpenFOAM. For OpenFOAM, pass either the .foam case marker file or the case directory itself (a folder containing the mesh files, a polyMesh/ folder, or a constant/polyMesh/ folder).

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. The format is detected from the file's extension / content, and any FEM model the file contains (materials, sets, surfaces, parts) is attached to the imported volume mesh.

Signature:

import_volume_mesh_from_disk(fileName: str) -> str

Parameters:

ParameterTypeDescription
fileNamestrThe full path of the volume mesh file to import. Supported formats: VTK (.vtu, .vtk), Abaqus / CalculiX (.inp), Nastran (.bdf, .nas), LS-DYNA (.k, .dyn, .key), ANSYS (.cdb), Gmsh (.msh), Fluent (.msh), and OpenFOAM. For OpenFOAM, pass either the .foam case marker file or the case directory itself (a folder containing the mesh files, a polyMesh/ folder, or a constant/polyMesh/ folder).

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. This writes only the VTK mesh geometry (.vtu / .vtk). It does not write the attached FEM model (materials, node/element sets, surfaces, parts) as a solver model. To export to a solver file format together with the FEM model, get the FEM operations group with volume_mesh_operations.get_fem_operations() and call one of its export functions, e.g. export_to_abaqus, export_to_nastran, export_to_ls_dyna, export_to_gmsh, export_to_fluent, export_to_open_foam, or the generic export_to_format.

Signature:

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

Parameters:

ParameterTypeDescription
volumeMeshNameslistA list containing the names of the volume meshes to export.
directoryPathstrThe path to the directory where the volume mesh files will be saved.
fileExtensionstrThe file extension to use for the exported volume mesh files. Supported file extensions are: vtu, vtk.
isASCIIboolIf 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. This writes only the VTK mesh geometry (.vtu / .vtk). It does not write the attached FEM model (materials, node/element sets, surfaces, parts) as a solver model. To export to a solver file format together with the FEM model, get the FEM operations group with volume_mesh_operations.get_fem_operations() and call one of its export functions, e.g. export_to_abaqus, export_to_nastran, export_to_ls_dyna, export_to_gmsh, export_to_fluent, export_to_open_foam, or the generic export_to_format.

Signature:

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

Parameters:

ParameterTypeDescription
volumeMeshNamestrThe name of the volume mesh to export.
fileNamestrThe 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'.
isASCIIboolIf 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
volumeMeshNameslistList of volume mesh names to rotate.
angleDegreesfloatRotation angle in degrees.
axislistRotation axis [x, y, z].
centerlistRotation center point [x, y, z] (ignored if aroundObjectCentroid=True).
aroundObjectCentroidboolIf 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
volumeMeshNameslistList of volume mesh names to translate.
translationlistTranslation 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
volumeMeshNameslistList of volume mesh names to scale.
scaleFactorslistScale factors [x, y, z].

transform​

Applies a transformation matrix to the specified volume meshes.

Signature:

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

Parameters:

ParameterTypeDescription
volumeMeshNameslistList of volume mesh names to transform.
matrixlistTransformation matrix [16 elements].

General​

reorient​

Applies a six-parameter rigid reorientation to volume meshes.

Signature:

reorient(volumeMeshNames: list, translation: list, rotationAnglesDegrees: list, center: list = [0.0, 0.0, 0.0], aroundObjectCentroid: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameslistList of volume mesh names to transform.
translationlistTranslation vector [x, y, z] in model units.
rotationAnglesDegreeslistXYZ Euler rotation angles in degrees.
centerlistRotation center [x, y, z] (ignored if aroundObjectCentroid=True).
aroundObjectCentroidboolIf true, rotates around object's bounding box centroid.

mirror​

Mirrors volume meshes across specified axes.

Signature:

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

Parameters:

ParameterTypeDescription
volumeMeshNameslistList of volume mesh names to mirror.
mirrorXboolMirror across X axis.
mirrorYboolMirror across Y axis.
mirrorZboolMirror 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
volumeMeshNameslistList 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
volumeMeshNameslistA list containing the names of the volume meshes to convert.

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


See Also​