Skip to main content

FemOperations

Operations

Provides tools for managing Finite Element Model (FEM) data on volume meshes. The FemOperations class enables scripting access to FEM model management including materials, parts, node sets, element sets, surfaces, and export to various solver formats.

Import

import ScriptingApi as api

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

Methods

Creation

create_fem_model

Creates or initializes an FEM model for the specified volume mesh. If the volume mesh already has an FEM model, this clears and reinitializes it. The FEM model is automatically synchronized with the mesh geometry (nodes and elements).

Signature:

create_fem_model(volumeMeshName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh to create the FEM model for.

Returns: bool — True if the FEM model was created successfully; false otherwise.


create_part

Creates a new part in the FEM model.

Signature:

create_part(volumeMeshName: str, params: FemPartParams) -> str

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
paramsanyPart parameters including name, material, and section properties.

Returns: str — The name of the created part, or an empty string if creation failed.


create_part_from_element_set

Creates a part from an existing element set. Elements in the set are assigned to the new part.

Signature:

create_part_from_element_set(volumeMeshName: str, elementSetName: str, partName: str, materialName: str = "") -> str

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set to convert.
partNameanyThe name for the new part.
materialNameanyThe name of the material to assign (empty for none).

Returns: str — The name of the created part, or an empty string if creation failed.


create_node_set

Creates a node set in the FEM model.

Signature:

create_node_set(volumeMeshName: str, params: FemNodeSetParams) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
paramsanyNode set parameters including name and node IDs.

Returns: bool — True if the node set was created successfully; false otherwise.


create_node_set_from_roi

Creates a node set from nodes inside a visible ROI primitive.

Signature:

create_node_set_from_roi(volumeMeshName: str, roiName: str, nodeSetName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
roiNameanyThe name of the ROI primitive.
nodeSetNameanyThe name for the new node set.

Returns: bool — True if the node set was created successfully; false otherwise.


create_element_set

Creates an element set in the FEM model.

Signature:

create_element_set(volumeMeshName: str, params: FemElementSetParams) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
paramsanyElement set parameters including name and element IDs.

Returns: bool — True if the element set was created successfully; false otherwise.


create_element_set_from_roi

Creates an element set from elements inside a visible ROI primitive.

Signature:

create_element_set_from_roi(volumeMeshName: str, roiName: str, elementSetName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
roiNameanyThe name of the ROI primitive.
elementSetNameanyThe name for the new element set.

Returns: bool — True if the element set was created successfully; false otherwise.


create_surface

Creates a surface in the FEM model.

Signature:

create_surface(volumeMeshName: str, params: FemSurfaceParams) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
paramsanySurface parameters including name and type.

Returns: bool — True if the surface was created successfully; false otherwise.


create_surface_from_element_set

Creates a surface from the boundary of an element set.

Signature:

create_surface_from_element_set(volumeMeshName: str, elementSetName: str, surfaceName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set.
surfaceNameanyThe name for the new surface.

Returns: bool — True if the surface was created successfully; false otherwise.


create_sets_from_visible_roi

Creates node sets, element sets, and surfaces from all visible ROI primitives. For each visible ROI: - Creates a node set containing nodes inside the ROI - Creates an element set containing elements with centroids inside the ROI - Creates a boundary surface from the element set

Signature:

create_sets_from_visible_roi(volumeMeshName: str, nodeSetPrefix: str = "ROI_Nodes", elementSetPrefix: str = "ROI_Elements") -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
nodeSetPrefixanyPrefix for node set names (e.g., "ROI_Nodes" -> "ROI_Nodes_BoxPrimitive").
elementSetPrefixanyPrefix for element set names.

Returns: bool — True if sets and surfaces were created successfully; false otherwise.


Properties

has_fem_model

Checks whether the specified volume mesh has an FEM model.

Signature:

has_fem_model(volumeMeshName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh to check.

Returns: bool — True if the volume mesh has an FEM model; false otherwise.


get_model_statistics

Gets statistics about the FEM model on the specified volume mesh.

Signature:

get_model_statistics(volumeMeshName: str) -> FemModelStatistics

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: FemModelStatistics — FemModelStatistics containing counts of nodes, elements, materials, parts, and sets.


add_material_from_preset

Adds a material from a preset.

Signature:

add_material_from_preset(volumeMeshName: str, preset: FemMaterialPreset, name: str = "") -> str

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
presetanyMaterial preset. Use api.FemMaterialPreset.Steel, Aluminum, etc.
nameanyOptional custom name for the material. If empty, uses preset name.

Returns: str — The name of the created material, or an empty string if creation failed.


get_materials

Gets all materials in the FEM model.

Signature:

get_materials(volumeMeshName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: list — List of material information structures.


get_material_by_name

Gets a material by name.

Signature:

get_material_by_name(volumeMeshName: str, materialName: str) -> FemMaterialInfo

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
materialNameanyThe name of the material.

Returns: FemMaterialInfo — Material information, or empty info if not found.


get_parts

Gets all parts in the FEM model.

Signature:

get_parts(volumeMeshName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: list — List of part information structures.


get_part_by_name

Gets a part by its name.

Signature:

get_part_by_name(volumeMeshName: str, partName: str) -> FemPartInfo

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
partNameanyThe name of the part.

Returns: FemPartInfo — Part information, or empty info if not found.


add_nodes_to_set

Adds nodes to an existing node set.

Signature:

add_nodes_to_set(volumeMeshName: str, nodeSetName: str, nodeIds: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
nodeSetNameanyThe name of the node set.
nodeIdsanyList of node IDs to add.

Returns: bool — True if nodes were added successfully; false otherwise.


remove_nodes_from_set

Removes nodes from an existing node set.

Signature:

remove_nodes_from_set(volumeMeshName: str, nodeSetName: str, nodeIds: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
nodeSetNameanyThe name of the node set.
nodeIdsanyList of node IDs to remove.

Returns: bool — True if nodes were removed successfully; false otherwise.


remove_node_set

Removes a node set from the FEM model.

Signature:

remove_node_set(volumeMeshName: str, nodeSetName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
nodeSetNameanyThe name of the node set to remove.

Returns: bool — True if the node set was removed successfully; false otherwise.


rename_node_set

Renames a node set.

Signature:

rename_node_set(volumeMeshName: str, oldName: str, newName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
oldNameanyThe current name of the node set.
newNameanyThe new name for the node set.

Returns: bool — True if the node set was renamed successfully; false otherwise.


get_node_sets

Gets all node sets in the FEM model.

Signature:

get_node_sets(volumeMeshName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: list — List of node set information structures.


get_node_set_by_name

Gets information about a specific node set.

Signature:

get_node_set_by_name(volumeMeshName: str, nodeSetName: str) -> FemNodeSetInfo

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
nodeSetNameanyThe name of the node set.

Returns: FemNodeSetInfo — Node set information, or empty info if not found.


get_node_set_node_ids

Gets the node IDs in a node set.

Signature:

get_node_set_node_ids(volumeMeshName: str, nodeSetName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
nodeSetNameanyThe name of the node set.

Returns: list — List of node IDs in the set.


add_elements_to_set

Adds elements to an existing element set.

Signature:

add_elements_to_set(volumeMeshName: str, elementSetName: str, elementIds: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set.
elementIdsanyList of element IDs to add.

Returns: bool — True if elements were added successfully; false otherwise.


remove_elements_from_set

Removes elements from an existing element set.

Signature:

remove_elements_from_set(volumeMeshName: str, elementSetName: str, elementIds: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set.
elementIdsanyList of element IDs to remove.

Returns: bool — True if elements were removed successfully; false otherwise.


remove_element_set

Removes an element set from the FEM model.

Signature:

remove_element_set(volumeMeshName: str, elementSetName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set to remove.

Returns: bool — True if the element set was removed successfully; false otherwise.


rename_element_set

Renames an element set.

Signature:

rename_element_set(volumeMeshName: str, oldName: str, newName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
oldNameanyThe current name of the element set.
newNameanyThe new name for the element set.

Returns: bool — True if the element set was renamed successfully; false otherwise.


get_element_sets

Gets all element sets in the FEM model.

Signature:

get_element_sets(volumeMeshName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: list — List of element set information structures.


get_element_set_by_name

Gets information about a specific element set.

Signature:

get_element_set_by_name(volumeMeshName: str, elementSetName: str) -> FemElementSetInfo

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set.

Returns: FemElementSetInfo — Element set information, or empty info if not found.


get_element_set_element_ids

Gets the element IDs in an element set.

Signature:

get_element_set_element_ids(volumeMeshName: str, elementSetName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
elementSetNameanyThe name of the element set.

Returns: list — List of element IDs in the set.


get_surfaces

Gets all surfaces in the FEM model.

Signature:

get_surfaces(volumeMeshName: str) -> list

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: list — List of surface information structures.


get_surface_by_name

Gets information about a specific surface.

Signature:

get_surface_by_name(volumeMeshName: str, surfaceName: str) -> FemSurfaceInfo

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
surfaceNameanyThe name of the surface.

Returns: FemSurfaceInfo — Surface information, or empty info if not found.


clear_all_fem_visualizations

Clears all FEM visualizations (node sets, element sets, surfaces, parts) from the 3D view. Removes all FEM-related visual actors from the renderer, restoring the default mesh view.

Signature:

clear_all_fem_visualizations() -> None

General

clear_fem_data

Clears all FEM data (materials, parts, sets, surfaces) from the model. The mesh nodes and elements are preserved; only FEM-specific data is removed.

Signature:

clear_fem_data(volumeMeshName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.

Returns: bool — True if the FEM data was cleared successfully; false otherwise.


add_material

Adds a material to the FEM model.

Signature:

add_material(volumeMeshName: str, params: FemMaterialParams) -> str

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
paramsanyMaterial parameters including name, properties, and model type.

Returns: str — The ID of the created material, or -1 if creation failed.


update_material

Updates an existing material's properties.

Signature:

update_material(volumeMeshName: str, materialName: str, params: FemMaterialParams) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
materialNameanyThe name of the material to update.
paramsanyNew material parameters.

Returns: bool — True if the material was updated successfully; false otherwise.


remove_material

Removes a material from the FEM model.

Signature:

remove_material(volumeMeshName: str, materialName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
materialNameanyThe name of the material to remove.

Returns: bool — True if the material was removed successfully; false otherwise.


assign_elements_to_part

Assigns elements to a part.

Signature:

assign_elements_to_part(volumeMeshName: str, partName: str, elementIds: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
partNameanyThe name of the part.
elementIdsanyList of element IDs to assign to the part.

Returns: bool — True if elements were assigned successfully; false otherwise.


assign_material_to_part

Assigns a material to a part.

Signature:

assign_material_to_part(volumeMeshName: str, partName: str, materialName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
partNameanyThe name of the part.
materialNameanyThe name of the material to assign.

Returns: bool — True if the material was assigned successfully; false otherwise.


update_part

Updates a part's properties.

Signature:

update_part(volumeMeshName: str, partName: str, params: FemPartParams) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
partNameanyThe name of the part to update.
paramsanyNew part parameters.

Returns: bool — True if the part was updated successfully; false otherwise.


remove_part

Removes a part from the FEM model.

Signature:

remove_part(volumeMeshName: str, partName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
partNameanyThe name of the part to remove.

Returns: bool — True if the part was removed successfully; false otherwise.


detect_boundary_surfaces

Automatically detects and creates external boundary surfaces.

Signature:

detect_boundary_surfaces(volumeMeshName: str, surfaceName: str = "BoundarySurface") -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
surfaceNameanyThe name for the boundary surface.

Returns: bool — True if boundary surfaces were detected and created; false otherwise.


remove_surface

Removes a surface from the FEM model.

Signature:

remove_surface(volumeMeshName: str, surfaceName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
surfaceNameanyThe name of the surface to remove.

Returns: bool — True if the surface was removed successfully; false otherwise.


rename_surface

Renames a surface.

Signature:

rename_surface(volumeMeshName: str, oldName: str, newName: str) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
oldNameanyThe current name of the surface.
newNameanyThe new name for the surface.

Returns: bool — True if the surface was renamed successfully; false otherwise.


File System

export_to_abaqus

Exports the FEM model to Abaqus format (.inp).

Signature:

export_to_abaqus(volumeMeshName: str, outputPath: str, options: FemAbaqusExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output file path (should end with .inp).
optionsanyAbaqus-specific export options.

Returns: FemExportResult — Export result with status and statistics.


export_to_nastran

Exports the FEM model to Nastran format (.nas/.bdf).

Signature:

export_to_nastran(volumeMeshName: str, outputPath: str, options: FemNastranExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output file path (should end with .nas or .bdf).
optionsanyNastran-specific export options.

Returns: FemExportResult — Export result with status and statistics.


export_to_ls_dyna

Exports the FEM model to LS-DYNA format (.k/.dyn).

Signature:

export_to_ls_dyna(volumeMeshName: str, outputPath: str, options: FemLsDynaExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output file path (should end with .k or .dyn).
optionsanyLS-DYNA-specific export options.

Returns: FemExportResult — Export result with status and statistics.


export_to_open_foam

Exports the FEM model to OpenFOAM polyMesh format.

Signature:

export_to_open_foam(volumeMeshName: str, outputPath: str, options: FemOpenFOAMExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output directory path for the OpenFOAM case.
optionsanyOpenFOAM-specific export options.

Returns: FemExportResult — Export result with status and statistics.


export_to_fluent

Exports the FEM model to Fluent format (.msh).

Signature:

export_to_fluent(volumeMeshName: str, outputPath: str, options: FemFluentExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output file path (should end with .msh).
optionsanyFluent-specific export options.

Returns: FemExportResult — Export result with status and statistics.


export_to_gmsh

Exports the FEM model to Gmsh format (.msh).

Signature:

export_to_gmsh(volumeMeshName: str, outputPath: str, options: FemGmshExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output file path (should end with .msh).
optionsanyGmsh-specific export options.

Returns: FemExportResult — Export result with status and statistics.


export_to_format

Exports the FEM model to a specified format.

Signature:

export_to_format(volumeMeshName: str, outputPath: str, format: FemExportFormat, options: FemExportOptions) -> FemExportResult

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh.
outputPathanyThe output file path.
formatanyThe export format. Use api.FemExportFormat.Abaqus, Nastran, etc.
optionsanyCommon export options.

Returns: FemExportResult — Export result with status and statistics.


UI

show_node_sets

Shows or hides visualization for specific node sets in the 3D view. Displays selected node sets as colored points in the 3D viewport. Each node set is rendered with a distinct color from the predefined color palette.

Signature:

show_node_sets(volumeMeshName: str, nodeSetNames: list, visible: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh containing the FEM model.
nodeSetNamesanyList of node set names to visualize. Empty list shows all node sets.
visibleanyTrue to show visualization, false to hide.

show_element_sets

Shows or hides visualization for specific element sets in the 3D view. Displays selected element sets as colored semi-transparent cells with edges. Useful for inspecting specific regions or material zones in the mesh.

Signature:

show_element_sets(volumeMeshName: str, elementSetNames: list, visible: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh containing the FEM model.
elementSetNamesanyList of element set names to visualize. Empty list shows all element sets.
visibleanyTrue to show visualization, false to hide.

show_surfaces

Shows or hides visualization for specific surfaces in the 3D view. Displays boundary surfaces with color coding and edge highlighting. Surfaces are rendered semi-transparently to allow viewing internal structures.

Signature:

show_surfaces(volumeMeshName: str, surfaceNames: list, visible: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh containing the FEM model.
surfaceNamesanyList of surface names to visualize. Empty list shows all surfaces.
visibleanyTrue to show visualization, false to hide.

show_parts

Shows or hides visualization for specific parts in the 3D view. Displays parts as colored regions using their assigned material colors (if set) or automatic color assignment from the palette. Parts are rendered with edges for clear boundary identification.

Signature:

show_parts(volumeMeshName: str, partNames: list, visible: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh containing the FEM model.
partNamesanyList of part names to visualize. Empty list shows all parts.
visibleanyTrue to show visualization, false to hide.

See Also