dsh-cad 0.16.1 → 0.17.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 +9 -0
- package/README.zh-CN.md +9 -0
- package/lib/client.js +169 -169
- package/lib/client.js.map +3 -3
- package/lib/modeling/assembly.js +318 -215
- package/lib/modeling/cadorange-adapter.cjs +75 -0
- package/lib/modeling/cadorange-bridge.cjs +10 -0
- package/lib/modeling/joints.js +442 -0
- package/lib/modeling/modeling-worker.cjs +88 -0
- package/lib/tools/cad-model.js +2282 -1797
- package/lib/types/modeling/assembly.d.ts +106 -78
- package/lib/types/modeling/client.d.ts +279 -227
- package/lib/types/modeling/joints.d.ts +129 -0
- package/lib/types/tools/cad-model.d.ts +16 -16
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -48,6 +48,8 @@ Cumulative downloads from the npm registry, refreshed daily by CI:
|
|
|
48
48
|
| 🏗️ 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. `cad_loft` sections accept **curves** too: point loops, `{through}` splines or planar `{profile}` chains; `smooth: true` fits a **periodic B-spline** through point loops — one continuous B-spline lateral face instead of planar strips meeting at G0 creases |
|
|
49
49
|
| ✏️ Named sketches | Standalone named profiles (Sketch1…) kept in the document (`cad_sketch_new` / `edit` / `list` / `delete`); extrude/revolve/sweep reference them **by name**, and `cad_sketch_edit` rewrites the definition in place + replays the log, rebuilding every dependent feature — the parametric loop. Sketches render as Onshape-style **blue curves + plane frame** in the viewport (refreshing live on edit), listed in a left-side **feature tree** (sketches + features, eye-toggle visibility, click-to-highlight bodies) over the Part tab |
|
|
50
50
|
| 🗂️ 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 |
|
|
51
|
+
| 🔩 Joint-driven assemblies | The build123d joint family (rigid/revolute/linear/cylindrical/ball/planar/polar): `cad_assembly_joint` defines, `cad_assembly_connect` pairs-and-solves (parent fixed, child repositioned onto the joint frames), `cad_assembly_drive` drives motion values with cascading re-solve (motion studies), `cad_assembly_explode` for exploded views; the assembly-tree panel gains a JOINTS section (kind/current value/pairing link). Pure main-thread placement algebra — kernel-independent, replays from the op log |
|
|
52
|
+
| 📥 STEP assembly import | `cad_step_import` imports a STEP document as an assembly: names, nesting and instance placements survive, identical geometry dedupes into one body referenced by N instances (a bolt pattern is one body); files cache as content-addressed workspace assets so op-log replay stays self-contained (cadorange kernel) |
|
|
51
53
|
| 📁 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 |
|
|
52
54
|
| 📐 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 |
|
|
53
55
|
| 🔗 Constraint solving & motion | **Ansatz** geometric constraint solver (**one command: `npm install ansatz-wasm`** — a wasm dependency, no Rust toolchain, no native binary): entity/constraint modeling (assembly instances ↔ rigid3 poses mapped automatically), solve-with-writeback, full DOF/residual/redundancy/suggestion diagnostics (LLM-oriented), and parametric kinematic sweeps (`cad_constraint` / `cad_solve` / `cad_motion`) |
|
|
@@ -131,6 +133,13 @@ Set `DEEPSEEK_API_KEY` and you are ready — for example:
|
|
|
131
133
|
| `cad_assembly_insert` | Insert a body into the assembly as a placed instance (`at` position, `rotate` orientation) |
|
|
132
134
|
| `cad_assembly_move` | Set an instance's absolute placement |
|
|
133
135
|
| `cad_assembly_remove` | Remove an instance from the assembly (the body stays) |
|
|
136
|
+
| `cad_assembly_joint` | Define a joint on an instance (build123d family: rigid/revolute/linear/cylindrical/ball/planar/polar), frame in the instance's local coordinates |
|
|
137
|
+
| `cad_assembly_connect` | Pair joints to place a child: the parent stays fixed, the child is repositioned so both joint frames coincide (optional connect-time drive value) |
|
|
138
|
+
| `cad_assembly_drive` | Drive a joint's motion value and re-solve every pairing (one motion-study step; ranges enforced) |
|
|
139
|
+
| `cad_assembly_solve` | Re-solve all pairings at current joint values (after moving a parent manually) |
|
|
140
|
+
| `cad_assembly_explode` | Exploded-view factor (instances push radially from the assembly center; view-state only, exports/drawings stay assembled) |
|
|
141
|
+
| `cad_assembly_info` | Read the assembly state: placements + joint labels/types/values + pairings + explode factor |
|
|
142
|
+
| `cad_step_import` | Structured STEP import: names, part structure and placements survive; identical geometry dedupes into one body referenced by N instances |
|
|
134
143
|
| `cad_constraint` | Declare the constraint model: entities (assembly-instance bindings) + constraints (distance/angle/mate/coaxial…), persisted in the op log |
|
|
135
144
|
| `cad_solve` | Solve with Ansatz and write poses back; returns DOF/residual/redundancy/suggestion diagnostics |
|
|
136
145
|
| `cad_motion` | Kinematic sweep: drive one constraint value from `from` to `to`, solve frame by frame, apply the last pose, return the motion table |
|
package/README.zh-CN.md
CHANGED
|
@@ -45,6 +45,8 @@ npm 官方源的累计下载量,由 CI 每日刷新:
|
|
|
45
45
|
| 🏗️ 参数化建模 | 基本体、轮廓拉伸、**放样**、**扫掠**、**旋转体**、布尔、全边圆角/倒角、**抽壳**、**拔模**、**阵列(线性/圆周)**、变换;轮廓支持**曲线段**(圆弧/圆为精确 BRep,B 样条为采样近似)—— OCCT 精确 BRep,非网格近似 |
|
|
46
46
|
| ✏️ 命名草图 | 文档中独立的可命名轮廓(Sketch1…):`cad_sketch_new` / `edit` / `list` / `delete`;拉伸/旋转/扫掠**按名字引用**,`cad_sketch_edit` 原位改写定义并全量重放,所有引用特征级联重建——参数化闭环。草图以 Onshape 式**蓝色曲线 + 平面框**在视口中实时渲染(回改即刷新),并列于零件页签左侧的**特征树**(草图 + 特征、眼睛显隐、点选高亮实体) |
|
|
47
47
|
| 🗂️ Codex 式文档页签 | 右侧显示区页签栏 + 「+」菜单:**零件**(Part Studio,默认)/ **装配体**(实例插入/移动/移除)/ **工程图**(真实隐藏线图纸),页签可关闭、常驻不丢状态 |
|
|
48
|
+
| 🔩 关节驱动的装配体 | build123d 关节族(刚性/旋转/滑动/圆柱/球面/平面/极坐标):`cad_assembly_joint` 定义、`cad_assembly_connect` 配对求解(父侧固定、子侧重定位至关节帧重合)、`cad_assembly_drive` 驱动运动值并级联重解算(运动仿真)、`cad_assembly_explode` 爆炸视图;装配树面板新增 JOINTS 区(类型/当前值/配对链接);纯主线程位姿代数,与内核无关、随操作日志重放 |
|
|
49
|
+
| 📥 STEP 装配导入 | `cad_step_import` 结构化导入 STEP 装配文档:部件名/嵌套结构/实例位姿保留,相同几何自动去重为一个体被 N 实例引用(螺栓阵列即一个体);文件按内容寻址缓存为工作区资产,操作日志重放自洽(cadorange 内核) |
|
|
48
50
|
| 📁 多文档 file 空间 | 工作区命名的建模文档(`.dsh-cad/docs/`),每个会话绑定自己的活动文档——新会话从空文档开始,不再继承历史遗留零件;面板上的文件夹按钮列出全部文档(预览 / 删除),对话中用 `cad_doc_new` / `cad_doc_open` 切换建模目标 |
|
|
49
51
|
| 📐 工程图 | GB 第一角布局:主视图 / 俯视图 / 左视图 + 轴测图,**occt.ts** 内核(npm 依赖)真实隐藏线消除(虚线);图框、标题栏、总尺寸标注、标准比例系列;导出 SVG / DXF |
|
|
50
52
|
| 🔗 约束求解与运动 | 集成 **Ansatz** 几何约束求解器(**`ansatz-wasm` 一条命令即可**:`npm install ansatz-wasm`,零 Rust 工具链 / 零原生二进制 / 零依赖):实体/约束建模(装配实例 ↔ rigid3 位姿自动映射)、求解回写、DOF/残差/冗余/建议全量诊断(面向 LLM 的中文报告)、参数扫描运动学(`cad_constraint` / `cad_solve` / `cad_motion`) |
|
|
@@ -125,6 +127,13 @@ patch 内容以包根目录的 `cordis.patch.yml` 随包分发,安装器经同
|
|
|
125
127
|
| `cad_assembly_insert` | 将零件以实例插入装配体(`at` 定位、`rotate` 定向) |
|
|
126
128
|
| `cad_assembly_move` | 设置实例绝对位置/姿态 |
|
|
127
129
|
| `cad_assembly_remove` | 从装配体移除实例(零件保留) |
|
|
130
|
+
| `cad_assembly_joint` | 在实例上定义关节(build123d 关节族:刚性/旋转/滑动/圆柱/球面/平面/极坐标),帧位于实例局部坐标 |
|
|
131
|
+
| `cad_assembly_connect` | 关节配对求解放置:父侧固定、子实例重定位使两关节帧重合(可选 connect 时驱动值) |
|
|
132
|
+
| `cad_assembly_drive` | 驱动关节运动值并重解算全部配对(运动仿真一步;范围校验) |
|
|
133
|
+
| `cad_assembly_solve` | 按当前关节值重解算全部配对(手动移动父件后调用) |
|
|
134
|
+
| `cad_assembly_explode` | 爆炸视图系数(实例沿径向偏离装配中心;仅视图态,导出/图纸不受影响) |
|
|
135
|
+
| `cad_assembly_info` | 读取装配态:实例位姿 + 关节标签/类型/值 + 配对关系 + 爆炸系数 |
|
|
136
|
+
| `cad_step_import` | STEP 结构化导入:名称/部件结构/实例位姿保留,相同几何去重为一个体被 N 实例引用 |
|
|
128
137
|
| `cad_constraint` | 声明约束模型:实体(含装配实例绑定)+ 约束(distance/angle/mate/coaxial…),持久化于操作日志 |
|
|
129
138
|
| `cad_solve` | Ansatz 求解并回写装配位姿;返回 DOF 剩余/残差/冗余/建议全量诊断 |
|
|
130
139
|
| `cad_motion` | 运动学扫描:驱动一个约束值从 from 到 to 逐帧求解,应用末帧位姿并返回运动表 |
|