Agent写作
- 作者仓库星标 494
- 作者更新于 实时读取
- 作者仓库 pymapdl
- 领域
- 写作
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @ansys · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- Python
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: pymapdl-cli
description: How to use the PyMAPDL command-line interface to start, stop, list, and execute commands on MAPD…
category: 写作
runtime: Python
---
# pymapdl-cli 输出预览
## PART A: 任务判断
- 适用问题:文章、文案、发言稿、润色或结构化表达。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Commands at a glance / pymapdl start / Key options”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于文章、文案、发言稿、润色或结构化表达,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Commands at a glance / pymapdl start / Key options”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/prep7`、`/eof`、`/solu` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“Commands at a glance / pymapdl start / Key options”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: pymapdl-cli
description: How to use the PyMAPDL command-line interface to start, stop, list, and execute commands on MAPD…
category: 写作
source: ansys/pymapdl
---
# pymapdl-cli
## 什么时候使用
- pymapdl-cli 是写作方向的技能,帮你打磨文章、稿子、内容表达 适合处理文章、文案、润色、翻译、总结和结构化表达,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继…
- 面向文章、文案、发言稿、润色或结构化表达,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Commands at a glance / pymapdl start / Key options」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "pymapdl-cli" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Commands at a glance / pymapdl start / Key options
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Python | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} PyMAPDL CLI
The pymapdl CLI lets you manage MAPDL instances and execute APDL commands
directly from the terminal. It is installed automatically with the
ansys-mapdl-core Python package and requires the click dependency (included
by default).
A typical session looks like this:
pymapdl start # launch a solver instance
pymapdl exec -c /prep7 -c "K,1,0,0,0" # send commands to it
pymapdl exec --file model.inp # or send a whole script
pymapdl stop # shut it down
All commands print human-readable output to stdout and errors to stderr. Exit code is 0 on success, 1 on failure.
Commands at a glance
| Command | Purpose |
|---|---|
pymapdl start |
Launch a new local MAPDL instance |
pymapdl stop |
Kill one or all running instances |
pymapdl list |
Show running MAPDL processes |
pymapdl exec |
Send APDL commands to a running instance |
pymapdl convert |
Translate an APDL script to Python |
pymapdl start
Launch a new MAPDL gRPC server. Prints the IP, port, and PID on success.
pymapdl start [OPTIONS]
Key options
| Option | Default | Description |
|---|---|---|
--port |
50052 (or PYMAPDL_PORT) |
gRPC port; first available port at or after this value |
--exec_file |
auto-detected | Path to the MAPDL executable |
--run_location |
temp dir | Working directory for the MAPDL process |
--jobname |
file |
MAPDL jobname |
--nproc |
2 | Number of processors |
--ram |
all available | Fixed memory in MB |
--override |
off | Delete stale lock files before starting |
--additional_switches |
none | Extra MAPDL command-line switches (e.g. aa_r for academic license) |
--start_timeout |
45 | Seconds to wait for the server to become ready |
--license_type |
none | License name (e.g. meba, ansys) or description (e.g. enterprise) |
--version |
latest | MAPDL version to launch (e.g. 241, 24.1) |
Example — start on a custom port with 4 CPUs:
pymapdl start --port 50055 --nproc 4
# Success: Launched an MAPDL instance (PID=12345) at 127.0.0.1:50055
pymapdl stop
Stop running MAPDL instances. By default targets port 50052.
pymapdl stop [OPTIONS]
Options
| Option | Description |
|---|---|
--port PORT |
Stop instances listening on this port |
--pid PID |
Stop the process (and its children) with this PID |
--all |
Stop every MAPDL instance on the machine |
Examples:
pymapdl stop # stop instance on default port 50052
pymapdl stop --port 50055 # stop instance on port 50055
pymapdl stop --pid 12345 # stop a specific process tree
pymapdl stop --all # stop all MAPDL processes
pymapdl list
List MAPDL processes currently running on the machine.
pymapdl list [OPTIONS]
Options
| Option | Short | Description |
|---|---|---|
--instances |
-i |
Show only parent instances (hide child processes) |
--long |
-l |
Show all columns (command line + working directory) |
--cmd |
-c |
Include the command-line column |
--location |
-cwd |
Include the working-directory column |
Example:
pymapdl list -i
# Name Status gRPC port PID
# ANSYS241.exe running 50052 41644
pymapdl exec
Send APDL commands to an already running MAPDL instance and print the
solver output. This command never starts a new instance — use pymapdl start
first.
pymapdl exec [OPTIONS] [-]
Three input modes (mutually exclusive)
Repeated
-c/--command(recommended for scripting and LLM use):pymapdl exec -c /prep7 -c "BLOCK,0,1,0,1,0,1" -c SAVEEach
-cvalue is one APDL command. They are joined with newlines and sent as a singleinput_strings()block for maximum performance.File with
--file/-f:pymapdl exec --file model.inpStdin by passing
-as a positional argument:# Linux / macOS cat model.inp | pymapdl exec - # Windows PowerShell Get-Content model.inp | pymapdl exec -
Options
| Option | Short | Default | Description |
|---|---|---|---|
--command |
-c |
— | APDL command (repeatable) |
--file |
-f |
— | Path to an APDL script file |
--port |
— | 50052 (or PYMAPDL_PORT) |
gRPC port of the target instance |
--ip |
— | 127.0.0.1 (or PYMAPDL_IP) |
IP of the target instance |
--timeout |
— | 10 | Connection timeout in seconds |
--clear-on-connect |
— | off | Clear MAPDL database before sending commands |
Behavior notes
- Successive calls share state. Because
--clear-on-connectis off by default, you can split a workflow across multiplepymapdl execinvocations and the model/mesh/results persist between them. - Output goes to stdout, errors to stderr — ideal for piping, logging, or LLM consumption.
- Windows paths are safe. Backslash sequences like
C:\new\fileare preserved verbatim; no mangling occurs.
pymapdl convert
Convert an APDL script to a PyMAPDL Python script.
pymapdl convert [OPTIONS]
Key options
| Option | Short | Default | Description |
|---|---|---|---|
--file |
-f |
stdin | APDL input file |
--output |
-o |
stdout | Output Python file |
--macros_as_functions |
-mf |
True | Convert macros to Python functions |
--use_function_names |
-fn |
True | Use method names (mapdl.k) instead of mapdl.run('K') |
--only_commands |
-oc |
off | Emit only MAPDL calls (no imports/header/exit) |
--add_imports |
-ai |
True | Add launch_mapdl() boilerplate |
--comment_solve |
-cs |
off | Comment out SOLVE / /EOF lines |
Example:
pymapdl convert -f model.inp -o model.py
Environment variables
| Variable | Used by | Purpose |
|---|---|---|
PYMAPDL_PORT |
start, exec |
Default gRPC port when --port is omitted |
PYMAPDL_IP |
exec |
Default IP when --ip is omitted |
PYMAPDL_MAPDL_EXEC |
start |
Path to MAPDL executable |
Common workflows
Interactive modeling session
pymapdl start --port 50055
pymapdl exec --port 50055 -c /prep7
pymapdl exec --port 50055 -c "ET,1,186" -c "BLOCK,0,1,0,1,0,1" -c "VMESH,ALL"
pymapdl exec --port 50055 --file boundary_conditions.inp
pymapdl exec --port 50055 -c /solu -c SOLVE
pymapdl stop --port 50055
Run a full script in one shot
pymapdl start
pymapdl exec --file full_model.inp
pymapdl stop
Pipe commands from another tool
# Generate APDL dynamically and pipe it in
python generate_mesh.py | pymapdl exec -
Fresh database each time
pymapdl exec --clear-on-connect -c /prep7 -c "K,1,0,0,0"
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核