Use Codex, Claude Code, or another AI agent to work with Ansys Mechanical models through sim-cli.
sim-plugin-mechanical gives an agent practical Mechanical control paths:
drive a live Mechanical GUI through PyMechanical, inspect runtime health, add
loads/supports/solution objects, solve, summarize the model tree, and extract
or describe result artifacts.
The Mechanical application and SDK are not bundled. Bring your own Mechanical installation. See LICENSE-NOTICE.md.
This plugin is for Ansys Mechanical, not Dassault SIMULIA Abaqus. Use the Abaqus plugin for Abaqus decks and Abaqus/CAE scripts.
- Mutate a live Mechanical model through Mechanical's IronPython API.
- Keep GUI-visible work synchronized with SDK state in
guimode. - Inspect
session.health,mechanical.project.identity, andmechanical.model.summarybefore each bounded setup or solve step. - Add and inspect supports, loads, mesh state, solution objects, and result objects.
- Detect solver/result artifacts such as result files, solver output, error files, and exported CSV data.
- Continue a Workbench Static Structural handoff once the Model cell is ready.
Use this when the user wants to watch or review the Mechanical tree while the agent works:
uv run sim connect --solver mechanical --ui-mode gui
uv run sim inspect session.health
uv run sim exec --file setup_step.py
uv run sim inspect mechanical.model.summaryIn GUI mode, Mechanical's visible window and PyMechanical client mutate the same in-memory model. Use screenshots for visual review, but use structured inspect targets for acceptance decisions.
Use --ui-mode no_gui only when visual confirmation is not needed:
uv run sim connect --solver mechanical --ui-mode no_guiHeadless mode is faster but screenshot confirmation is unavailable. Inspect
session.health.ui_capabilities before relying on GUI observations.
Workbench owns Engineering Data, Geometry, and Model. Mechanical owns setup, solve, and results. Before applying Mechanical loads or supports, inspect:
uv run sim inspect mechanical.project.identity
uv run sim inspect mechanical.model.summaryContinue only when the expected analysis exists and the geometry/body state is non-empty.
Install these before asking an agent to use this plugin:
- Python 3.10 or newer.
- uv for Python environment and package installs.
- git when installing from GitHub source refs.
- A project Python environment where sim-cli-core can be installed.
- A local Ansys Mechanical installation compatible with PyMechanical.
The plugin does not include Mechanical or vendor SDK binaries. It installs the Python adapter and its Python dependencies only.
For agent projects, install sim-cli-core and the Mechanical plugin in the project environment:
uv init # only if this is not already a uv project
uv add sim-cli-core sim-plugin-mechanical
uv run sim plugin sync-skills --target .agents/skills --copy
uv run sim check mechanical
uv run sim plugin doctor mechanical --deepFor Claude Code, sync the bundled skill to .claude/skills instead:
uv run sim plugin sync-skills --target .claude/skills --copyFor a reproducible agent run, pin a commit SHA:
uv add sim-cli-core "git+https://github.com/svd-ai-lab/sim-plugin-mechanical.git@<commit-sha>"If your environment uses SSH authentication:
uv add sim-cli-core "git+ssh://git@github.com/svd-ai-lab/sim-plugin-mechanical.git@<commit-sha>"uv run sim ... runs sim from this project environment, so it sees this
project's plugins. Without uv, create and activate a venv, then install
sim-cli-core plus this plugin with python -m pip.
After installation, sim-cli should auto-discover the driver and bundled skill:
uv run sim check mechanicalIf uv run sim check mechanical reports that Mechanical itself is unavailable,
first confirm the Python package installed correctly, then fix the local
Mechanical or SDK prerequisites.
Use GUI mode for agent-visible Mechanical workflows:
uv run sim connect --solver mechanical --ui-mode gui
uv run sim inspect session.health
uv run sim inspect mechanical.project.identity
uv run sim inspect mechanical.model.summaryUse headless mode only for non-visual smoke checks:
uv run sim connect --solver mechanical --ui-mode no_gui- Connect in GUI mode unless the user explicitly wants headless mode.
- Inspect
session.health,mechanical.project.identity, andmechanical.model.summary. - Run one bounded IronPython snippet.
- Inspect
last.resultandmechanical.model.summary. - Continue only when the model state matches the expected analysis, geometry, mesh, and result state.
- Treat
mechanical.solve.not_completedas a failed solve, even if the SDK transport returned successfully.
Workbench owns Engineering Data, Geometry, and Model cells. Mechanical owns setup, solve, and results. Before applying loads or supports:
uv run sim inspect mechanical.project.identity
uv run sim inspect mechanical.model.summaryContinue only when the expected analysis exists and geometry/body state is non-empty.
Update the published package:
uv add --upgrade sim-plugin-mechanicalUpdate from the latest GitHub main branch:
uv add "git+https://github.com/svd-ai-lab/sim-plugin-mechanical.git@main"Uninstall:
uv remove sim-plugin-mechanicalGive an agent this instruction when the task is about Mechanical:
Use the bundled Mechanical skill from sim-plugin-mechanical. Connect with
`uv run sim connect --solver mechanical --ui-mode gui` unless the user explicitly
wants headless mode. Before every setup, solve, or result step, inspect
`session.health`, `mechanical.project.identity`, and
`mechanical.model.summary`. Run one bounded IronPython snippet at a time,
return JSON from the last expression, inspect `last.result`, and use screenshots
only as visual confirmation. If the model came from Workbench, confirm the
handoff before applying loads or supports.
The bundled skill entry point is:
src/sim_plugin_mechanical/_skills/mechanical/SKILL.md
sim-plugin-mechanical extends sim-cli with the Mechanical-specific driver and
bundled Mechanical skill. sim-cli supplies the common runtime surface
(connect, exec, inspect, run, screenshot), while this plugin supplies
Mechanical detection, PyMechanical launch, IronPython execution, health checks,
model summaries, and result artifact diagnostics.
The plugin registers three entry-point groups:
[project.entry-points."sim.drivers"]
mechanical = "sim_plugin_mechanical:MechanicalDriver"
[project.entry-points."sim.skills"]
mechanical = "sim_plugin_mechanical:skills_dir"
[project.entry-points."sim.plugins"]
mechanical = "sim_plugin_mechanical:plugin_info"Some solver builds require insecure loopback transport for PyMechanical. Set
SIM_MECHANICAL_INSECURE_TRANSPORT=1 before starting the sim session if the
driver reports a secure-transport launch failure.
Use uv run sim inspect session.health. If ui_capabilities.screenshot_expected is
false, the session is headless. If screenshot support is expected but no
matching window is found, reconnect in GUI mode and inspect the health payload
before mutating more state.
git clone https://github.com/svd-ai-lab/sim-plugin-mechanical
cd sim-plugin-mechanical
uv sync
uv run pytest tests -m "not integration"End-to-end tests require a local Mechanical installation and are skipped unless their prerequisites are available.
Apache-2.0. See LICENSE and LICENSE-NOTICE.md.