FemOperations
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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
params | any | Part 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
elementSetName | any | The name of the element set to convert. |
partName | any | The name for the new part. |
materialName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
params | any | Node 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
roiName | any | The name of the ROI primitive. |
nodeSetName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
params | any | Element 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
roiName | any | The name of the ROI primitive. |
elementSetName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
params | any | Surface 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
elementSetName | any | The name of the element set. |
surfaceName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
nodeSetPrefix | any | Prefix for node set names (e.g., "ROI_Nodes" -> "ROI_Nodes_BoxPrimitive"). |
elementSetPrefix | any | Prefix 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
preset | any | Material preset. Use api.FemMaterialPreset.Steel, Aluminum, etc. |
name | any | Optional 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
materialName | any | The 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:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | The name of the volume mesh. |
Returns: list — List of part information structures.