dsh-cad 0.7.0 → 0.9.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 CHANGED
@@ -29,9 +29,10 @@ switchable demo parts (bracket / flange / shaft):
29
29
 
30
30
  | Capability | Description |
31
31
  | --- | --- |
32
+ | ⚙️ Single-kernel architecture | **occt.ts as the primary modeling kernel** (true B-splines, native shell/draft, centroid); opencascade.js stays only as the fallback backend; the v0.8 "no editing after shell" seam is gone — fillet/chamfer/boolean keep working after shelling |
32
33
  | 🔍 CAD viewing | STL / OBJ / STEP / IGES / BREP / DCPRT (3D), DXF / SVG (2D); interactive in-chat card (orbit / zoom / wireframe / pan) |
33
34
  | 🧭 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 |
35
+ | 🏗️ 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
36
  | 🗂️ 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
37
  | 📁 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
38
  | 📐 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 +102,8 @@ Set `DEEPSEEK_API_KEY` and you are ready — for example:
101
102
  | `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
103
  | `cad_chamfer` | Chamfer: bevel every sharp edge with one equal distance (mm) |
103
104
  | `cad_pattern` | Pattern: linear (`delta` spacing) or circular (principal axis + `at` point + sweep angle); creates copy bodies, fuse afterwards for one body |
105
+ | `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 |
106
+ | `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
107
  | `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
108
  | `cad_boolean` | fuse / cut / common (classic hole punching: plate cut cylinder) |
106
109
  | `cad_fillet` | Constant-radius fillet on all sharp edges |
@@ -129,7 +132,7 @@ versioned URL), and the "3D" tab tracks the latest model in real time.
129
132
 
130
133
  ## Connectors (roadmap)
131
134
 
132
- Modeling today runs on the **built-in WebGL-class kernel** (OCCT in the browser —
135
+ Modeling primarily runs on the **occt.ts kernel** (opencascade.js as the fallback backend) (OCCT in the browser —
133
136
  zero install). The connectors below refer to **external CAD engines** acting as
134
137
  executors for the same tool family, planned for future support:
135
138
 
@@ -190,6 +193,16 @@ cad_view(path) modeling tools (cad_create_prim, …)
190
193
  exponential-map rotation, radians). Solver capability is staged
191
194
  (point-distance-to-origin today) — the plumbing contract is finished and needs
192
195
  no changes as it grows
196
+ - **Single-kernel architecture (v0.9)**: the primary modeling kernel is now
197
+ **occt.ts >= 0.5.0** — primitives, curve-segment profiles (TRUE B-spline
198
+ interpolation), loft/sweep/revolve, booleans, fillet/chamfer, shell/draft,
199
+ mirror (composed as scale(-1) + a π rotation) and centroid all live in one
200
+ session; engineering-drawing HLR takes the shape directly (zero STEP hops);
201
+ editing after shelling is seamless (the v0.8 hosted-body seam is deleted).
202
+ opencascade.js remains as the FALLBACK backend (auto-selected when occt.ts
203
+ cannot load). Assembly STEP export degrades to a fused single solid (no
204
+ compound binding); instance separation stays in the assembly scene/document.
205
+ Face selection matches `describe()` plane normals (outermost along ±normal)
193
206
  - **Client**: esbuild single-file CJS factory (three.js inlined ~560KB, react provided
194
207
  by the host module table), Z-up CAD convention, empty scene with XYZ axis labels
195
208
  and a ground grid always displayed
package/README.zh-CN.md CHANGED
@@ -27,9 +27,10 @@
27
27
 
28
28
  | 能力 | 说明 |
29
29
  | --- | --- |
30
+ | ⚙️ 单内核架构 | **occt.ts 为主建模内核**(真 BSpline、抽壳/拔模原生、质心),opencascade.js 仅作为加载失败时的降级后端;v0.8 的「抽壳后不可编辑」接缝消失——抽壳/拔模后可继续圆角/倒角/布尔 |
30
31
  | 🔍 CAD 查看 | STL / OBJ / STEP / IGES / BREP / DCPRT(3D),DXF / SVG(2D),对话内嵌交互卡片(轨道旋转 / 缩放 / 线框 / 平移) |
31
32
  | 🧭 CAD 编辑器交互 | Onshape 风格 ViewCube(26 区域点击定向)、悬停/点选面与边实时测量(面积 mm² / 长度 mm)、面+边 / 面 / 线框三种渲染模式、支架 / 法兰 / 轴 BRep 示例件一键切换 |
32
- | 🏗️ 参数化建模 | 基本体、轮廓拉伸、**放样**、**扫掠**、**旋转体**、布尔、全边圆角/倒角、**阵列(线性/圆周)**、变换;轮廓支持**曲线段**(圆弧/圆为精确 BRep,B 样条为采样近似)—— OCCT 精确 BRep,非网格近似 |
33
+ | 🏗️ 参数化建模 | 基本体、轮廓拉伸、**放样**、**扫掠**、**旋转体**、布尔、全边圆角/倒角、**抽壳**、**拔模**、**阵列(线性/圆周)**、变换;轮廓支持**曲线段**(圆弧/圆为精确 BRep,B 样条为采样近似)—— OCCT 精确 BRep,非网格近似 |
33
34
  | 🗂️ Codex 式文档页签 | 右侧显示区页签栏 + 「+」菜单:**零件**(Part Studio,默认)/ **装配体**(实例插入/移动/移除)/ **工程图**(真实隐藏线图纸),页签可关闭、常驻不丢状态 |
34
35
  | 📁 多文档 file 空间 | 工作区命名的建模文档(`.dsh-cad/docs/`),每个会话绑定自己的活动文档——新会话从空文档开始,不再继承历史遗留零件;面板上的文件夹按钮列出全部文档(预览 / 删除),对话中用 `cad_doc_new` / `cad_doc_open` 切换建模目标 |
35
36
  | 📐 工程图 | GB 第一角布局:主视图 / 俯视图 / 左视图 + 轴测图,**occt.ts** 内核(npm 依赖,OCCT 7.9)真实隐藏线消除(虚线);图框、标题栏、总尺寸标注、标准比例系列;导出 SVG / DXF |
@@ -97,6 +98,8 @@ patch 内容以包根目录的 `cordis.patch.yml` 随包分发,安装器经同
97
98
  | `cad_revolve` | 旋转体:闭合轮廓绕轴回转(profile 坐标 = (半径, 高度),支持曲线段——圆角轮缘精确),`angle` 角度可选 |
98
99
  | `cad_chamfer` | 倒角:全锐边等距离斜切(mm) |
99
100
  | `cad_pattern` | 阵列:线性(delta 间距)或圆周(主轴 + at 轴点 + 总角度),生成副本体,可再 fuse 合并 |
101
+ | `cad_shell` | 抽壳:壁厚向内生长、外表面保留;`open` 为开口面的外法向列表(空 = 封闭内腔)。经 occt.ts 内核执行,结果为**托管体** |
102
+ | `cad_draft` | 拔模:壁面绕中性面倾斜 `angle` 度(脱模斜度),`direction` 为拔模方向,默认自动选平行于该方向的壁面。经 occt.ts 内核执行,结果为**托管体** |
100
103
  | `cad_sweep` | 扫掠:闭合 2D 轮廓沿 3D 路径([x,y,z…])扫出实体;轮廓自动置于路径起点垂面,无需手工定向 |
101
104
  | `cad_boolean` | fuse / cut / common(经典打孔:plate cut cylinder) |
102
105
  | `cad_fillet` | 全锐边等半径圆角 |
@@ -125,7 +128,7 @@ patch 内容以包根目录的 `cordis.patch.yml` 随包分发,安装器经同
125
128
 
126
129
  ## 连接器(规划中)
127
130
 
128
- 建模目前已由**内置的 WebGL 级建模器**承担(浏览器内的 OCCT 内核,零安装);
131
+ 建模主要由 **occt.ts** 内核承担(opencascade.js 为降级后端)(浏览器内的 OCCT 内核,零安装);
129
132
  下表连接器指未来以**外部 CAD 引擎作为执行器**驱动同一工具族:
130
133
 
131
134
  | 连接器 | 套件 | 平台 | 状态 |
@@ -175,6 +178,13 @@ cad_view(path) 建模工具(cad_create_prim 等)
175
178
  原样透出给 LLM。装配实例位姿(平移 + XYZ 欧拉度)与求解器 rigid3(平移 + 指数映射
176
179
  旋转,弧度)双向映射。求解器能力按阶段推进(当前支持点到原点距离),管道契约
177
180
  已就绪、无需随求解器成长改动
181
+ - **单内核架构(v0.9)**:建模主内核切换为 **occt.ts ≥0.5.0**——prims/曲线段轮廓
182
+ (真 BSpline 插值)/放样/扫掠/旋转/布尔/圆角/倒角/抽壳/拔模/镜像(scale(-1)+
183
+ 旋转 π 组合)/质心全在一个会话内,工程图 HLR 直接吃 shape(零 STEP 中转),
184
+ 抽壳后继续编辑无缝(v0.8 的托管接缝删除)。opencascade.js 保留为**降级后端**
185
+ (occt.ts 加载失败时自动启用)。装配体 STEP 导出因无 compound 绑定降级为
186
+ fuse 单体(实例分离保留在装配场景/文档中)。面选择按 `describe()` 平面法向
187
+ 匹配(±法向取外侧投影最大者)
178
188
  - **客户端**:esbuild 单文件 CJS 工厂(three.js 内联 ~560KB,react 由宿主模块表提供),
179
189
  Z-up CAD 惯例,带 XYZ 轴标签与地面网格的空场景常驻显示
180
190