dsh-cad 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/README.zh-CN.md +9 -1
- package/lib/client.js +1 -1
- package/lib/client.js.map +2 -2
- package/lib/modeling/modeling-worker.cjs +54 -15
- package/lib/modeling/occt-bridge.cjs +157 -0
- package/lib/tools/cad-model.js +68 -0
- package/lib/types/modeling/client.d.ts +12 -0
- package/lib/types/tools/cad-model.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ switchable demo parts (bracket / flange / shaft):
|
|
|
31
31
|
| --- | --- |
|
|
32
32
|
| 🔍 CAD viewing | STL / OBJ / STEP / IGES / BREP / DCPRT (3D), DXF / SVG (2D); interactive in-chat card (orbit / zoom / wireframe / pan) |
|
|
33
33
|
| 🧭 CAD editor interactions | Onshape-style ViewCube (26-zone click-to-orient), hover/click face & edge picking with live measurement (area mm² / length mm), Faces+Edges / Faces / Wireframe render modes, switchable BRep demo parts (bracket / flange / shaft) |
|
|
34
|
-
| 🏗️ Parametric modeling | Primitives, profile extrusion, **loft**, **sweep**, **revolve**, booleans, all-edge fillet/chamfer, **patterns** (linear/circular), transforms; profiles take **curve segments** (arcs/circles exact BRep; B-splines sampled approximation) — exact OCCT BRep, not a mesh approximation |
|
|
34
|
+
| 🏗️ Parametric modeling | Primitives, profile extrusion, **loft**, **sweep**, **revolve**, booleans, all-edge fillet/chamfer, **shell**, **draft**, **patterns** (linear/circular), transforms; profiles take **curve segments** (arcs/circles exact BRep; B-splines sampled approximation) — exact OCCT BRep, not a mesh approximation |
|
|
35
35
|
| 🗂️ Codex-style document tabs | The resident display panel gets a tab strip with a "+" menu: **Part** (Part Studio, the default) / **Assembly** (instance insert/move/remove) / **Drawing** (true hidden-line sheets); tabs are closable and keep their state |
|
|
36
36
|
| 📁 Multi-document file space | Named documents per workspace (`.dsh-cad/docs/`), each session bound to its own active document — new sessions start empty instead of inheriting leftovers; a folder button in the panel lists every document (preview / delete), and `cad_doc_new` / `cad_doc_open` manage the modeling target from chat |
|
|
37
37
|
| 📐 Engineering drawings | GB first-angle layout: front / top / left views + isometric, true OCCT hidden-line removal via the **occt.ts** kernel (an npm dependency, dashed); sheet frame, title block, overall dimensions, standard scale series; exports SVG / DXF |
|
|
@@ -101,6 +101,8 @@ Set `DEEPSEEK_API_KEY` and you are ready — for example:
|
|
|
101
101
|
| `cad_revolve` | Solid of revolution: revolve a closed profile around an axis (profile coords = (radius, height); curve segments supported — rounded rims exact); optional `angle` |
|
|
102
102
|
| `cad_chamfer` | Chamfer: bevel every sharp edge with one equal distance (mm) |
|
|
103
103
|
| `cad_pattern` | Pattern: linear (`delta` spacing) or circular (principal axis + `at` point + sweep angle); creates copy bodies, fuse afterwards for one body |
|
|
104
|
+
| `cad_shell` | Shell: hollow to a wall thickness (inward, outer skin preserved); `open` lists outward normals of the faces to open (empty = sealed). Runs on the occt.ts kernel; the result is a HOSTED body |
|
|
105
|
+
| `cad_draft` | Draft: tilt the walls `angle` degrees about a neutral plane (mold release); `direction` is the pull direction, walls auto-selected by default. Runs on the occt.ts kernel; the result is a HOSTED body |
|
|
104
106
|
| `cad_sweep` | Sweep: pipe a closed 2D profile along a 3D [x,y,z,…] path; the profile is auto-placed on the start plane, so no manual orientation |
|
|
105
107
|
| `cad_boolean` | fuse / cut / common (classic hole punching: plate cut cylinder) |
|
|
106
108
|
| `cad_fillet` | Constant-radius fillet on all sharp edges |
|
|
@@ -190,6 +192,14 @@ cad_view(path) modeling tools (cad_create_prim, …)
|
|
|
190
192
|
exponential-map rotation, radians). Solver capability is staged
|
|
191
193
|
(point-distance-to-origin today) — the plumbing contract is finished and needs
|
|
192
194
|
no changes as it grows
|
|
195
|
+
- **Dual-kernel hosted bodies (shell/draft)**: opencascade.js cannot read
|
|
196
|
+
geometry BACK (STEPControl_Reader / BRepTools readers are opaque no-method
|
|
197
|
+
shells in that build), so shell/draft run on occt.ts (>= 0.3.0, crossing as
|
|
198
|
+
STEP bytes) and the result stays HOSTED as STEP bytes on the occt.ts side —
|
|
199
|
+
volume, .step export and display meshes keep working through occt.ts, while
|
|
200
|
+
opencascade.js-exclusive edits (fillet/chamfer/loft/sweep/revolve/boolean)
|
|
201
|
+
on a hosted body are REFUSED with guidance to model first and shell last.
|
|
202
|
+
Face selection matches `describe()` plane normals (outermost along ±normal)
|
|
193
203
|
- **Client**: esbuild single-file CJS factory (three.js inlined ~560KB, react provided
|
|
194
204
|
by the host module table), Z-up CAD convention, empty scene with XYZ axis labels
|
|
195
205
|
and a ground grid always displayed
|
package/README.zh-CN.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
| --- | --- |
|
|
30
30
|
| 🔍 CAD 查看 | STL / OBJ / STEP / IGES / BREP / DCPRT(3D),DXF / SVG(2D),对话内嵌交互卡片(轨道旋转 / 缩放 / 线框 / 平移) |
|
|
31
31
|
| 🧭 CAD 编辑器交互 | Onshape 风格 ViewCube(26 区域点击定向)、悬停/点选面与边实时测量(面积 mm² / 长度 mm)、面+边 / 面 / 线框三种渲染模式、支架 / 法兰 / 轴 BRep 示例件一键切换 |
|
|
32
|
-
| 🏗️ 参数化建模 |
|
|
32
|
+
| 🏗️ 参数化建模 | 基本体、轮廓拉伸、**放样**、**扫掠**、**旋转体**、布尔、全边圆角/倒角、**抽壳**、**拔模**、**阵列(线性/圆周)**、变换;轮廓支持**曲线段**(圆弧/圆为精确 BRep,B 样条为采样近似)—— OCCT 精确 BRep,非网格近似 |
|
|
33
33
|
| 🗂️ Codex 式文档页签 | 右侧显示区页签栏 + 「+」菜单:**零件**(Part Studio,默认)/ **装配体**(实例插入/移动/移除)/ **工程图**(真实隐藏线图纸),页签可关闭、常驻不丢状态 |
|
|
34
34
|
| 📁 多文档 file 空间 | 工作区命名的建模文档(`.dsh-cad/docs/`),每个会话绑定自己的活动文档——新会话从空文档开始,不再继承历史遗留零件;面板上的文件夹按钮列出全部文档(预览 / 删除),对话中用 `cad_doc_new` / `cad_doc_open` 切换建模目标 |
|
|
35
35
|
| 📐 工程图 | GB 第一角布局:主视图 / 俯视图 / 左视图 + 轴测图,**occt.ts** 内核(npm 依赖,OCCT 7.9)真实隐藏线消除(虚线);图框、标题栏、总尺寸标注、标准比例系列;导出 SVG / DXF |
|
|
@@ -97,6 +97,8 @@ patch 内容以包根目录的 `cordis.patch.yml` 随包分发,安装器经同
|
|
|
97
97
|
| `cad_revolve` | 旋转体:闭合轮廓绕轴回转(profile 坐标 = (半径, 高度),支持曲线段——圆角轮缘精确),`angle` 角度可选 |
|
|
98
98
|
| `cad_chamfer` | 倒角:全锐边等距离斜切(mm) |
|
|
99
99
|
| `cad_pattern` | 阵列:线性(delta 间距)或圆周(主轴 + at 轴点 + 总角度),生成副本体,可再 fuse 合并 |
|
|
100
|
+
| `cad_shell` | 抽壳:壁厚向内生长、外表面保留;`open` 为开口面的外法向列表(空 = 封闭内腔)。经 occt.ts 内核执行,结果为**托管体** |
|
|
101
|
+
| `cad_draft` | 拔模:壁面绕中性面倾斜 `angle` 度(脱模斜度),`direction` 为拔模方向,默认自动选平行于该方向的壁面。经 occt.ts 内核执行,结果为**托管体** |
|
|
100
102
|
| `cad_sweep` | 扫掠:闭合 2D 轮廓沿 3D 路径([x,y,z…])扫出实体;轮廓自动置于路径起点垂面,无需手工定向 |
|
|
101
103
|
| `cad_boolean` | fuse / cut / common(经典打孔:plate cut cylinder) |
|
|
102
104
|
| `cad_fillet` | 全锐边等半径圆角 |
|
|
@@ -175,6 +177,12 @@ cad_view(path) 建模工具(cad_create_prim 等)
|
|
|
175
177
|
原样透出给 LLM。装配实例位姿(平移 + XYZ 欧拉度)与求解器 rigid3(平移 + 指数映射
|
|
176
178
|
旋转,弧度)双向映射。求解器能力按阶段推进(当前支持点到原点距离),管道契约
|
|
177
179
|
已就绪、无需随求解器成长改动
|
|
180
|
+
- **双内核托管体(shell/draft)**:opencascade.js 无法读回几何(STEPControl_Reader /
|
|
181
|
+
BRepTools 读取器均为无方法空壳),因此 shell/draft 借道 occt.ts(≥0.3.0,
|
|
182
|
+
STEP 字节跨内核)后,结果以 **STEP 字节托管**在 occt.ts 会话——体积、.step
|
|
183
|
+
导出、显示网格均经 occt.ts 保持可用;opencascade.js 独占的编辑(圆角/倒角/
|
|
184
|
+
放样/扫掠/旋转/布尔)对托管体**明确拒绝**并提示先建模后抽壳。面选择按
|
|
185
|
+
`describe()` 的平面法向匹配(±法向取外侧投影最大者)
|
|
178
186
|
- **客户端**:esbuild 单文件 CJS 工厂(three.js 内联 ~560KB,react 由宿主模块表提供),
|
|
179
187
|
Z-up CAD 惯例,带 XYZ 轴标签与地面网格的空场景常驻显示
|
|
180
188
|
|