A python wrapper for Ansys Mechanical
Project description
Overview
PyMechanical is a Python interface for Ansys Mechanical (FEA software for structural engineering), enabling automation and integration of simulation workflows from 2024 R2 and later.
PyMechanical provides two distinct modes of interaction:
Embedding mode — Run Mechanical directly in your Python process via the App class. Full object-model access, fast startup, ideal for Jupyter notebooks and interactive scripting.
Remote session mode — Launch Mechanical as a separate server process and communicate via gRPC. Process isolation, optional GUI, ideal for CI/CD, Docker, and automation.
Compatibility
Python: 3.10 – 3.13
Mechanical: 2024 R2 (v242) and later
Platforms: Windows, Linux
Installation
Install from PyPI:
pip install ansys-mechanical-core
For graphics support:
pip install ansys-mechanical-core[graphics]
For RPC functionality:
pip install ansys-mechanical-core[rpc]
Requirements:
Licensed copy of Ansys Mechanical (2024 R2 or later).
For embedded mode: Local Mechanical installation required.
For remote session mode: Network access to a running Mechanical instance.
Quick start
Embedding mode:
from ansys.mechanical.core import App
app = App(globals=globals())
print(app)
# Access Mechanical objects directly
Model.AddStaticStructuralAnalysis()
Remote session mode:
from ansys.mechanical.core import launch_mechanical
mechanical = launch_mechanical()
result = mechanical.run_python_script("2+3")
print(result) # Output: 5
mechanical.exit()
Connect to existing instance:
from ansys.mechanical.core import connect_to_mechanical
mechanical = connect_to_mechanical(port=10000)
result = mechanical.run_python_script("Model.Name")
print(result)
Troubleshooting
Connection refused: Ensure Mechanical is running and the port is accessible.
License error: Verify your Ansys license is properly configured.
Import error: Check that ansys-pythonnet is installed (not pythonnet).
Linux embedding: Use mechanical-env to run Python scripts for embedded mode.
Documentation and support
Issues — report bugs or request features
Discussions — ask questions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ansys_mechanical_core-0.12.6.tar.gz.
File metadata
- Download URL: ansys_mechanical_core-0.12.6.tar.gz
- Upload date:
- Size: 105.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
935b982b6095bd010579b0aa54f70656dd944a704da26e5cae58d3061e41de50
|
|
| MD5 |
a49379b32e783454ee6801402c149a08
|
|
| BLAKE2b-256 |
a83b3e65d666316175a2125fc749bed269c8493c43f3782f3f2776bcc82530d8
|
Provenance
The following attestation bundles were made for ansys_mechanical_core-0.12.6.tar.gz:
Publisher:
ci_cd.yml on ansys/pymechanical
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansys_mechanical_core-0.12.6.tar.gz -
Subject digest:
935b982b6095bd010579b0aa54f70656dd944a704da26e5cae58d3061e41de50 - Sigstore transparency entry: 1288579011
- Sigstore integration time:
-
Permalink:
ansys/pymechanical@e446f678fc2d5a358099938997f1f3af39d4ed3a -
Branch / Tag:
refs/tags/v0.12.6 - Owner: https://github.com/ansys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci_cd.yml@e446f678fc2d5a358099938997f1f3af39d4ed3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file ansys_mechanical_core-0.12.6-py3-none-any.whl.
File metadata
- Download URL: ansys_mechanical_core-0.12.6-py3-none-any.whl
- Upload date:
- Size: 161.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7431cd24a67250cbeef803d9d2466de07fc251cbcd9e5cd75253597014d5882b
|
|
| MD5 |
8aa940b2fea6a5100dacbb9b5380e07b
|
|
| BLAKE2b-256 |
ed4e7b5a557bd420b8a9e41a0ba99b7d958a628fc72ac6ac98c4c5f1b34df399
|
Provenance
The following attestation bundles were made for ansys_mechanical_core-0.12.6-py3-none-any.whl:
Publisher:
ci_cd.yml on ansys/pymechanical
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansys_mechanical_core-0.12.6-py3-none-any.whl -
Subject digest:
7431cd24a67250cbeef803d9d2466de07fc251cbcd9e5cd75253597014d5882b - Sigstore transparency entry: 1288579073
- Sigstore integration time:
-
Permalink:
ansys/pymechanical@e446f678fc2d5a358099938997f1f3af39d4ed3a -
Branch / Tag:
refs/tags/v0.12.6 - Owner: https://github.com/ansys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci_cd.yml@e446f678fc2d5a358099938997f1f3af39d4ed3a -
Trigger Event:
push
-
Statement type: