Skip to content
OpenSmartRoute
Skillv1.0.0

chili3d

Use when building browser-based 3D CAD applications with WebAssembly — STEP/B-Rep visualization, measurement tools, sectioning. Chili3D: pure Web 3D CAD built on OCCT.js compiled to WASM with TypeScri

by znlgis(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from znlgis/opengis-skills (cad/chili3d/SKILL.md). Install upstream with npx skills add znlgis/opengis-skills --skill chili3d. Copyright stays with the author.

项目地址: https://github.com/xiangechen/chili3d

在线体验: https://chili3d.com/

许可证: AGPL-3.0

概述

Chili3D 主要特性:

  • 纯前端 CAD:基于 Three.js + OCCT.js(WebAssembly)
  • 参数化建模:草图、特征树、约束求解
  • 基础几何:立方体、圆柱、棱柱、扫掠、放样、布尔
  • 修饰:圆角、倒角、抽壳
  • 数据交换:STEP / IGES / BREP / STL / OBJ / glTF
  • 保存格式:自有 JSON 项目格式
  • 国际化:内置中/英文

在线使用

直接打开 https://chili3d.com/

  1. 选择「新建」或导入 STEP/IGES
  2. 左侧工具栏:Sketch / Box / Cylinder / Sphere / ...
  3. 右侧属性面板:编辑参数、变换
  4. 顶部菜单:Boolean / Fillet / Chamfer / Shell
  5. 文件 → 导出(STEP/STL/glTF)

本地部署 / 二次开发

git clone https://github.com/xiangechen/chili3d.git
cd chili3d
pnpm install
pnpm dev          # 本地开发服务器(http://localhost:5173)
pnpm build        # 静态构建

构建产物可直接部署到任何静态托管(Nginx / Cloudflare Pages / GitHub Pages)。


项目结构

packages/
├── chili-core/         # 模型、命令、应用框架
├── chili-geo/          # 几何抽象、Visual
├── chili-three/        # Three.js 渲染
├── chili-occ/          # OCCT.js WebAssembly 桥接
├── chili-controls/     # 草图控件、操控器
├── chili-builder/      # 拉伸/扫掠/放样等特征构建器
├── chili-ui/           # UI 组件
└── chili-web/          # 主 Web 应用

嵌入到自有应用

<div id="cad" style="width:100%;height:100vh"></div>
<script type="module">
  import { Application } from '@chili3d/web';
  const app = new Application(document.getElementById('cad'));
  await app.start();
</script>

或作为 iframe:

<iframe src="https://chili3d.com/" allow="cross-origin-isolated"
        style="width:100%;height:100vh;border:0"></iframe>

WebAssembly OCC 需要启用 SharedArrayBuffer,要求站点设置 Cross-Origin-Opener-Policy: same-originCross-Origin-Embedder-Policy: require-corp


使用 OCCT.js 直接构造(脚本扩展)

import { occt } from '@chili3d/occ';

const oc = await occt();
const box = new oc.BRepPrimAPI_MakeBox_2(100, 60, 30).Shape();
// 进一步通过 chili-core 的 Visual 对象包装显示

命令系统

Chili3D 命令通过 Command 注册:

import { Command } from '@chili3d/core';

@Command({ id: 'my.line', display: '我的直线' })
export class MyLineCommand {
    async execute(app) {
        const p1 = await app.input.getPoint('选择起点');
        const p2 = await app.input.getPoint('选择终点');
        app.activeView.document.add(LineFactory.byPoints(p1, p2));
    }
}

文件 I/O

  • 保存项目:菜单 File → Save → .chili JSON
  • 导出:File → Export → STEP/IGES/BREP/STL/OBJ/glTF
  • 导入:File → Import → 同上 + .chili

与 Three.js 集成

Chili3D 渲染层在 chili-three,可定制材质、光照、PBR:

import { ThreeView } from '@chili3d/three';
const view = ThreeView.fromCanvas(canvas);
view.scene.add(new THREE.AmbientLight(0xffffff, 0.5));

典型工作流

工作流一:在线参数化建模与导出

  1. 打开 https://chili3d.com/ 或本地部署实例
  2. 新建项目,使用 Sketch 工具绘制 2D 轮廓
  3. 通过 Extrude/Revolve 将草图转为 3D 实体
  4. 添加圆角、倒角等修饰特征
  5. 使用布尔运算(Union/Cut/Intersect)组合多个实体
  6. 导出为 STEP/STL 用于下游加工或 3D 打印

工作流二:嵌入业务系统作为 Web CAD 组件

  1. 在项目中安装 @chili3d/web
  2. 在页面中创建容器 <div>,实例化 Application
  3. 通过 Command 系统注册自定义绘图命令
  4. 监听文档变更事件,同步模型数据到后端
  5. 利用 OCCT.js 直接构造几何进行批量参数化生成
  6. 构建为静态资源部署到生产环境

性能要点

  1. WebAssembly OCCT 单线程(除非启用 pthreads + COOP/COEP)
  2. 大模型加载前先压缩 STEP,导入后转 BREP 缓存
  3. 渲染端使用 LOD:用 BVH 或 Decimator 减面
  4. 频繁布尔操作建议在 Worker 线程中执行
  5. 浏览器内存限制:模型大小通常不超过 100MB STEP

$h$faq`

问题 解决
加载 OCCT.wasm 失败 站点未启用 COOP/COEP;改用 cross-origin-isolated
无法导入 DWG 暂不支持 DWG,先转 DXF/STEP
中文菜单 Settings → Language 切换为中文
性能差 确认 Vite 构建为 production;启用浏览器 SIMD
模型透视错乱 检查相机近/远裁剪面与单位

适用场景

✅ 教育、Web 演示、轻量 3D 建模、定制配置器、嵌入业务系统 ❌ 大型工业装配、复杂曲面(仍推荐 FreeCAD/OCCT 桌面)


AI 使用建议

  • 推荐工作流模式:AI 助手应区分两种使用场景——在线建模(引导用户通过 GUI 操作)与二次开发(通过 TypeScript SDK 嵌入)。对后者,优先使用 @chili3d/occ 直接调用 OCCT.js 进行几何构造,而非通过 UI 层间接操作。
  • 关键注意事项:① WebAssembly OCCT 需要 COOP/COEP 头,部署时必须正确配置;② SharedArrayBuffer 依赖 HTTPS 或 localhost;③ OCCT.js 加载较慢(首次约 5-15s),需显示加载进度;④ 浏览器内存有限,大模型应考虑服务端处理。
  • 常用代码模式occt() 初始化 → BRepPrimAPI_MakeBox 等构造几何 → chili-core 的 Visual/Document 包装 → 渲染显示。自定义命令继承 Command 类,通过 app.input.getPoint() 获取用户交互。

相关技能


参考资源

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/znlgis-opengis-skills-chili3d/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

znlgis-opengis-skills-chili3d.ocm.jsonjson
{
  "ocm": "1",
  "id": "znlgis-opengis-skills-chili3d",
  "kind": "skill",
  "name": "chili3d",
  "description": "Use when building browser-based 3D CAD applications with WebAssembly — STEP/B-Rep visualization, measurement tools, sectioning. Chili3D: pure Web 3D CAD built on OCCT.js compiled to WASM with TypeScript API.",
  "publisher": "znlgis",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "web",
      "3d",
      "typescript",
      "wasm",
      "occt",
      "parametric",
      "step",
      "stl",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Use when building browser-based 3D CAD applications with WebAssembly — STEP/B-Rep visualization, measurement tools, sectioning. Chili3D: pure Web 3D CAD built on OCCT.js compiled to WASM with TypeScript API."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/znlgis/opengis-skills",
      "path": "cad/chili3d/SKILL.md",
      "ref": "0b5fdd414be45c3f59857ab9124c0708ccd6b665",
      "url": "https://github.com/znlgis/opengis-skills/blob/0b5fdd414be45c3f59857ab9124c0708ccd6b665/cad/chili3d/SKILL.md",
      "key": "znlgis/opengis-skills/cad/chili3d/SKILL.md"
    }
  },
  "instructions": "> **项目地址:** <https://github.com/xiangechen/chili3d>\n>\n> **在线体验:** <https://chili3d.com/>\n>\n> **许可证:** AGPL-3.0\n\n## 概述\n\nChili3D 主要特性:\n\n- **纯前端 CAD**:基于 Three.js + OCCT.js(WebAssembly)\n- **参数化建模**:草图、特征树、约束求解\n- **基础几何**:立方体、圆柱、棱柱、扫掠、放样、布尔\n- **修饰**:圆角、倒角、抽壳\n- **数据交换**:STEP / IGES / BREP / STL / OBJ / glTF\n- **保存格式**:自有 JSON 项目格式\n- **国际化**:内置中/英文\n\n---\n\n## 在线使用\n\n直接打开 <https://chili3d.com/>:\n\n1. 选择「新建」或导入 STEP/IGES\n2. 左侧工具栏:Sketch / Box / Cylinder / Sphere / ...\n3. 右侧属性面板:编辑参数、变换\n4. 顶部菜单:Boolean / Fillet / Chamfer / Shell\n5. 文件 → 导出(STEP/STL/glTF)\n\n---\n\n## 本地部署 / 二次开发\n\n```bash\ngit clone https://gith",
  "cost": {
    "context_tokens": 1138
  }
}

Fetch it by URL: GET /api/v1/registry/znlgis-opengis-skills-chili3d/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.