Logo Mechanical Sim

Mechanical Sim

Tổ chức
svd-ai-lab
mechanical-sim

Use when driving Ansys Mechanical via PyMechanical (ansys-mechanical-core) through the sim runtime, or reading solved `.rst` files with DPF on the agent side. Covers boundary conditions, loads, solver execution, and result extraction. This is the physics-layer counterpart to workbench-sim (which orchestrates cells 1-3); mechanical-sim owns cells 4-6 of the Static Structural workflow. Observation commands (`uv run sim screenshot` / `uv run sim inspect`) are tightly coupled with both the PyMechanical gRPC client *and* the Mechanical.exe GUI window — always launch with `batch=False` so the window is on the desktop for live sessions.

Tổng quan

Nhà phát hànhsvd-ai-lab
Kho mãsim-cli
Tên kỹ năngmechanical-sim
Sao
242
Bản fork
23
Tệp đi kèm
19
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 19 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được svd-ai-lab công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Mechanical Sim trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/svd-ai-lab/sim-cli/tree/main/plugins/mechanical/src/sim_plugin_mechanical/_skills/mechanical
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/svd-ai-lab/sim-cli.git /tmp/sim-cli
mkdir -p .claude/skills
cp -r /tmp/sim-cli/plugins/mechanical/src/sim_plugin_mechanical/_skills/mechanical .claude/skills/mechanical-sim
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Mechanical Sim trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Mechanical Sim ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Mechanical Sim với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

mechanical-sim

This file is the Ansys Mechanical index. Use DPF for solved .rst files on disk; use sim-cli/PyMechanical for live Mechanical sessions that mutate, solve, inspect, or update the GUI-backed project.

This is not the Abaqus plugin. Do not run Abaqus .inp decks or Abaqus/CAE scripts here. Use solver=abaqus for Dassault SIMULIA Abaqus; use solver=mechanical only for Ansys Mechanical / PyMechanical sessions.

The /connect response tells you which active layers apply:

json
"skills": {
  "root":               "<sim-skills>/mechanical",
  "active_sdk_layer":   "0.12",
  "active_solver_layer": "24.1"
}

Always read base/, then your active sdk/<version>/, then your active solver/<version>/. Later layers override earlier ones on identically-named files.


First principles

  1. Workbench orchestrates, Mechanical computes. PyWorkbench drives Engineering Data / Geometry / Model. PyMechanical drives Setup / Solution / Results. Do not try to define boundary conditions via Workbench scripting — that belongs here.

  2. Observation is SDK+GUI coupled. Every uv run sim exec is a mechanical.run_python_script(code) call that mutates Mechanical's in-memory model. Mechanical's window on the desktop redraws after each call. Therefore uv run sim screenshot (which grabs the desktop) always reflects the current SDK state. This coupling only works with batch=False — so the driver defaults to GUI mode. Confirm both ui_mode == "gui" and batch == false from inspect session.summary before relying on screenshots for GUI sync.

  3. Scripts run inside Mechanical's IronPython interpreter. Globals ExtAPI, DataModel, Model, Quantity, Tree are already available — do NOT import ansys.mechanical. The last expression's string form is what run_python_script returns, so end snippets with a json.dumps(...) literal to get structured output.

  4. ExtAPI.DataModel.Project is the root. From there: .Model → the scene; .Model.Analyses[0] → the first analysis; .Model.Geometry → bodies; .Model.Mesh → meshing controls; .Model.Materials → material assignments.


base/ — always relevant

PathWhat's there
base/reference/pymechanical_api.mdPyMechanical SDK surface: launch_mechanical, run_python_script, download_project, file transfer. Read first.
base/reference/scripting_tree.mdMechanical's IronPython scripting tree: ExtAPI, DataModel, Model, Tree, common traversal patterns.
base/reference/capability_discovery.mdGeneric method/feature discovery before adding analyses, BCs, results, or solve logic. Use this when the workflow differs from known snippets.
base/reference/bc_scoping.mdBoundary condition scoping: creating Selection objects, NamedSelection, face IDs, ISelectionInfo. This is the #1 source of errors.
base/reference/solve_control.mdTriggering solve (analysis.Solution.Solve(True)), monitoring state, reading solve messages.
base/reference/result_extraction.mdTraversing analysis.Solution to pull deformation/stress values, exporting to CSV, using .rst files.
base/reference/observation_commands.mdHow sim's observation commands couple with Mechanical. Read this before using uv run sim inspect / uv run sim screenshot against a Mechanical session.
base/snippets/Numbered snippets (01_smoke through 06_extract_results). Each ends with a json.dumps(...) literal for structured output.
base/workflows/static_structural/End-to-end walk through cells 4-6, continuing where workbench-sim left off.
base/workflows/model_review_loop.mdRequired checkpoint loop: inspect health, project identity, model summary, then run one bounded snippet.
base/workflows/debug_failed_exec.mdFailure triage loop for scoping, selections, mesh, solve, and result extraction failures.
base/workflows/workbench_handoff.mdWorkbench-to-Mechanical checklist for Static Structural workflows.
base/known_issues.mdQuirks: Chinese locale gRPC, batch-mode stdin, IronPython Unicode, Selection vs ISelectionInfo.

sdk/<active_sdk_layer>/

  • sdk/0.12/ — PyMechanical 0.12 (works with Ansys 24.1–25.2).
    • notes.md — launch_mechanical(version=241, batch=False), wait_till_mechanical_is_ready.

solver/<active_solver_layer>/

  • solver/24.1/ — Ansys Mechanical 24.1.
    • notes.md — scripting namespace: which ExtAPI members exist in 24.1.

Hard constraints

  1. Never launch with batch=True unless the user has explicitly asked for headless mode. sim's observation commands need the GUI.
  2. Never import ansys.mechanical.* inside a snippet that goes through run_python_script. The interpreter is Mechanical's embedded IronPython — the Python SDK is the wrong side of the wire.
  3. Always end snippets with json.dumps(...) to get structured stdout. run_python_script returns only the last expression's repr.
  4. Workbench skill owns cells 1-3. If the user asks for geometry import or material definition, hand back to workbench-sim.
  5. Never trust raw names or paths as public evidence. Return counts, booleans, self-created ASCII tags, or sanitized strings from snippets.
  6. Discover live capabilities before coding a new workflow. Use mechanical.capabilities, mechanical.object.properties:*, and official PyMechanical scripting docs to confirm available analysis, BC, result, and solve APIs. Do not infer physics support from AnalysisType strings alone.
  7. Observe long-running work out-of-band. During solves, updates, imports, or hangs, use screenshots and file/message polling while the SDK call is blocked. Read base/reference/observation_commands.md before starting any expected long-running operation.

Required protocol

If the user's question is about an existing solved project (a .rst on disk), use DPF on the agent side; do not launch Mechanical at all.

Before every Mechanical script:

  1. Read base/workflows/model_review_loop.md and inspect session.health, mechanical.project.identity, and mechanical.model.summary.
  2. For any workflow not already proven by a local snippet, read base/reference/capability_discovery.md and inspect mechanical.capabilities before adding setup objects.
  3. Check base/known_issues.md for the operation you are about to do.
  4. If this is a Workbench handoff, read base/workflows/workbench_handoff.md and confirm Mechanical sees the expected analysis and non-empty geometry.
  5. For long-running solve/update/import steps, capture a screenshot before the call, then monitor with screenshots and available solver files/messages until it completes or clearly fails.
  6. Run one bounded snippet, ending with json.dumps(...).
  7. Inspect last.result, mechanical.model.summary, and mechanical.messages after solve/result failures. In GUI mode, use a screenshot as visual confirmation after significant tree changes.
  8. If execution fails, switch to base/workflows/debug_failed_exec.md before trying another full script.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Mechanical Sim làm được gì?

Use when driving Ansys Mechanical via PyMechanical (ansys-mechanical-core) through the sim runtime, or reading solved `.rst` files with DPF on the agent side. Covers boundary conditions, loads, solver execution, and result extraction. This is the physics-layer counterpart to workbench-sim (which orchestrates cells 1-3); mechanical-sim owns cells 4-6 of the Static Structural workflow. Observation commands (`uv run sim screenshot` / `uv run sim inspect`) are tightly coupled with both the PyMechanical gRPC client *and* the Mechanical.exe GUI window — always launch with `batch=False` so the win...

Vì sao nên dùng Mechanical Sim trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Mechanical Sim là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Mechanical Sim trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/svd-ai-lab/sim-cli/tree/main/plugins/mechanical/src/sim_plugin_mechanical/_skills/mechanical. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Mechanical Sim?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Mechanical Sim với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Mechanical Sim với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Mechanical Sim có miễn phí không?

Có. Kỹ năng này được svd-ai-lab phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇