VolumeMeshOperations
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:
| Parameter | Type | Description |
|---|---|---|
fileNames | any | A 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:
| Parameter | Type | Description |
|---|---|---|
fileName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | A list containing the names of the volume meshes to export. |
directoryPath | any | The path to the directory where the volume mesh files will be saved. |
fileExtension | any | The file extension to use for the exported volume mesh files. Supported file extensions are: vtu, vtk. |
isASCII | any | If 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh to export. |
fileName | any | The 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'. |
isASCII | any | If 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | List of volume mesh names to rotate. |
angleDegrees | any | Rotation angle in degrees. |
axis | any | Rotation axis [x, y, z]. |
center | any | Rotation center point [x, y, z] (ignored if aroundObjectCentroid=True). |
aroundObjectCentroid | any | If true, rotates around object's bounding box centroid. |
translate
Translates volume meshes by a specified vector.
Signature:
translate(volumeMeshNames: list, translation: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | List of volume mesh names to translate. |
translation | any | Translation 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | List of volume mesh names to scale. |
scaleFactors | any | Scale factors [x, y, z]. |
transform
Applies a transformation matrix to the specified volume meshes.
Signature:
transform(volumeMeshNames: list, matrix: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | List of volume mesh names to transform. |
matrix | any | Transformation 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | List of volume mesh names to mirror. |
mirrorX | any | Mirror across X axis. |
mirrorY | any | Mirror across Y axis. |
mirrorZ | any | Mirror 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | List 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshNames | any | A list containing the names of the volume meshes to convert. |
Returns: list — A list of names for the created surface objects.