Zemax Python Connect

当用户提到 Zemax OpticStudio Python 连接、ZOS-API 配置、独立应用程序、交互扩展、CreateNewApplication、ConnectAsExtension、ZOSAPI_NetHelper.dll、NotAuthorized、PrimarySystem None、Instance Number,或在连接 Python 与 Zemax 时遇到 --replace-current 时使用。

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add Hao-xl/zemax-python-connect --skill zemax-python-connect
Manual install
git clone --depth 1 https://github.com/Hao-xl/zemax-python-connect.git /tmp/zemax-python-connect
mkdir -p ~/.claude/skills
cp -r /tmp/zemax-python-connect/. ~/.claude/skills/zemax-python-connect

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Zemax Python 连接

## 范围

本 skill 只负责建立和验证 Python 与 Zemax OpticStudio 的 ZOS-API 连接。

当连接状态不确定时,先使用本 skill。连接验证完成后,再使用 `zemax-python` 进行模型操作、评价函数、优化、分析和容差等后续工作。

本 skill 不负责光学系统设计,也不负责具体优化策略。

## Agent 执行契约(必须遵守)

1. 不假设 Python、Zemax 数据目录、OpticStudio 安装目录或版本与其他电脑相同。
2. 先运行 `doctor.py --mode locator`。只有已经验证 `ZOSAPI_NetHelper.dll` 存在,才允许初始化 `ZOSAPI_NetHelper`。
3. 初始化后必须读取 `GetZemaxDirectory()`,并再次确认实际安装目录中存在 `ZOSAPI.dll` 和 `ZOSAPI_Interfaces.dll`。
4. 独立模式必须满足 `APP_MODE=Server`;交互模式必须满足 `APP_MODE=Plugin`。仅有非空 `app` 不代表成功。
5. 两种模式都必须确认有效许可证和非空 `PrimarySystem`。
6. 独立模式只关闭 Python 自己创建的实例;即使连接中途失败,也必须清理已创建的应用。
7. 交互模式永远不调用 `CloseApplication()`。
8. 不自动结束用户已有的 OpticStudio 进程。需要结束进程时,先解释原因并取得用户同意。
9. 每次报告解析到的数据根目录、实际安装目录、NetHelper 路径、版本、许可证、应用模式和 `PrimarySystem` 状态。
10. 路径发现必须按顺序执行:Windows 快速来源 → 自动有限深度磁盘搜索 → 经用户明确允许的全盘搜索。禁止跳过授权直接全盘搜索。
11. 全盘搜索前必须告知用户:通常约 2–15 分钟,文件很多或磁盘较慢时可能超过 30 分钟;只有用户明确允许后,才可传入 `--exhaustive-search --confirm-long-scan`。
12. 磁盘搜索必须汇报已扫描目录数、权限拒绝目录数、其他扫描错误数和耗时,不得静默忽略权限失败。

## Codex/Agent 沙箱重要规则

OpticStudio ZOS-API 使用 .NET Remoting IPC。某些 Agent 沙箱允许读取 DLL,却会阻止 IPC 连接。典型错误包括:

```text
System.Runtime.Remoting.RemotingException
连接到 IPC 端口失败: 拒绝访问
Access denied
```

出现 `ERROR_CODE=IPC_ACCESS_DENIED` 时,不要继续猜测 DLL、许可证或实例编号,也不要反复重启 Zemax。应向用户说明原因并请求批准,在 Agent 沙箱外重新运行完全相同的 Zemax Python 命令。沙箱外执行仍必须限制为本 skill 的诊断或连接脚本。

## 连接模式选择

| 用户目标 | 推荐模式 | API |
|---|---|---|
| 批量自动化、创建/打开/保存文件,不需要观察 GUI 实时变化 | 独立应用程序 | `CreateNewApplication()` |
Read the full skill on GitHub

Details

Skill name
zemax-python-connect
License
MIT
Repo updated
12 July 2026

FAQ

What does the Zemax Python Connect skill do?

当用户提到 Zemax OpticStudio Python 连接、ZOS-API 配置、独立应用程序、交互扩展、CreateNewApplication、ConnectAsExtension、ZOSAPI_NetHelper.dll、NotAuthorized、PrimarySystem None、Instance Number,或在连接 Python 与 Zemax 时遇到 --replace-current 时使用。

How do I install the Zemax Python Connect skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add Hao-xl/zemax-python-connect --skill zemax-python-connect. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Zemax Python Connect popular?

It lives in Hao-xl/zemax-python-connect, which has 9 GitHub stars and 0 forks.

Related skills

Code Function

7

lyp1278471473/code-function

Turn any project into one self-contained interactive HTML map that answers: which code implements this feature/page? Show every feature of the project, and for each, all the code across frontend/backend/database/workers with exact file:line — clickable to open in the user's editor. Use when the user says 'code-function', '功能地图', '这个功能对应哪段代码', '生成功能地图', 'locate the code for <feature>', or asks to map features/pages to their implementation. Also use to refresh a map generated earlier.

Software Development

Wechat Miniprogram Skill

9

Gourdbaby/wechat-miniprogram-skill

Expert guidelines for Native WeChat Mini Program development focusing on performance, code size, and native compatibility. Use when developing WeChat Mini Programs in native JavaScript.

Software Development

CodexCleanUp

8

manwithshit/CodexCleanUp

检查当前 Codex 会话是否属于正确的 Project,并在用户选择推荐分组后,使用官方 Codex App 能力在目标 Project 下创建一个带压缩上下文的交接会话。保留原会话、原标题和原归属,不关闭 App,不修改本地私有状态。用户说“整理当前会话”“这个会话该放哪个 Project”“帮我调整分组”“清理 Codex 会话”“codex clean up”“CodexCleanUp”或明确要求把当前会话交接到另一个 Project 时使用。

Software Development

Swe CLI Skills

8

SylphAI-Inc/swe-cli-skills

Senior engineer CLI expertise for AI agents — workflows, safety guardrails, gotchas, and anti-patterns across cloud, IaC, containers, databases, dev tools, and platforms

Software Development

Lixi Reverse

7

wobushilixi/lixi-reverse

【启动词:李喜,路径,需求】李喜 = 安卓授权/卡密验证的全自动逆向绕过。 四层判型:控制面 APK/dex · 脚本面 壳里的 .lua · 载荷面 ELF/.so · 特权面 .ko 内核模块; 另加服务端判决面(真响应重放 / 假服务器 / SNI 侦察)。一个入口脚本跑完只读分析并出 【带原字节的可执行命令】。23 个 Python 工具 + 3 个跨语言第一响应,不依赖 jadx/apktool/frida。 核心判据:能不能破由"判决归属"决定,不由"加密强度"决定。输出语言:中文。 触发词:李喜 / 安卓逆向 / APK / dex / 卡密 / 授权 / 内核模块 / ko / 驱动 / ELF / so / 脱壳 / 加固 / 重放 / 绕过。

Software Development

Spec Driven Development

9

mariano-aguero/spec-driven-development-skill

Structures feature work for AI coding agents into gated phases — research, spec, plan, tasks, implement, validate — each producing a short reviewable artifact that constrains the next. Use when requirements are informal or drift-prone, when the same prompt produces different implementations across sessions, or when a feature touches auth, database schema, or API contracts. Keywords: spec-driven development, SDD, spec.md, plan.md, tasks.md, constitution.md, acceptance criteria, drift detection.

Software Development

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.