@wae/open-cad-skills 0.0.0-stage → 0.0.1

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
@@ -1,3 +1,28 @@
1
- # Temporary Holding Version
1
+ # @wae/open-cad-skills
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Agent skills for OpenCAD. The package ships skill documents only; it is not a
4
+ runtime library and contains no DWG, DXF, STEP, IGES or mesh code.
5
+
6
+ ## Status
7
+
8
+ Executable document routes. `skills/open-cad/SKILL.md` lists the commands that
9
+ work today: create/open `.ocad` drawings, add, move, update and delete entities,
10
+ transform, copy, array, explode and measure, undo/redo, add and edit layers,
11
+ inspect the document, import the declared ASCII DXF subset, and export SVG, DXF,
12
+ PDF, STL or STEP. The skill states the limits of the build: no viewport
13
+ renderer, no DWG/STEP importer, no full DXF reader, no STL reader and no
14
+ constraint solver.
15
+
16
+ ## Layout
17
+
18
+ ```text
19
+ packages/open-cad-skills/
20
+ ├── package.json
21
+ ├── README.md
22
+ └── skills/
23
+ └── open-cad/
24
+ └── SKILL.md
25
+ ```
26
+
27
+ The skill must never be shipped claiming methods, commands or flags that the
28
+ installed SDK/CLI does not expose.
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
+ "description": "Agent skills for OpenCAD: drawing, layer, constraint and exchange tasks",
3
+ "engines": {
4
+ "node": ">=18"
5
+ },
6
+ "files": [
7
+ "skills"
8
+ ],
9
+ "keywords": [
10
+ "open-cad",
11
+ "cad",
12
+ "drawing",
13
+ "skills",
14
+ "agent"
15
+ ],
16
+ "license": "Apache-2.0",
2
17
  "name": "@wae/open-cad-skills",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "repository": {
22
+ "directory": "projects/packages/open-cad-skills",
23
+ "type": "git",
24
+ "url": "git+https://github.com/nyar-os/OpenCAD.git"
25
+ },
26
+ "type": "module",
27
+ "version": "0.0.1"
28
+ }
@@ -0,0 +1,403 @@
1
+ ---
2
+ name: open-cad
3
+ description: Create, revise, inspect and deliver technical drawings with OpenCAD. Use when a task involves drawings, layers, dimensions or CAD exchange formats.
4
+ ---
5
+
6
+ # open-cad
7
+
8
+ ## Status
9
+
10
+ Working document core. The installed CLI and SDK can create and open `.ocad`
11
+ drawings, add lines, points, circles, arcs, ellipses, polylines, text, hatches, linear,
12
+ radial or diameter and ordinate dimensions,
13
+ transform (translate/rotate/scale/mirror), copy, array (rectangular or polar),
14
+ explode a polyline, offset a circle/arc/polyline/line, fillet or chamfer two lines and
15
+ measure a drawing, selected entities, the distance between two points or the
16
+ angle at three points, move, update and
17
+ delete entities, undo and redo,
18
+ add, rename, merge, delete, hide, lock, freeze and mark layers as non-plottable, list, add, update and remove
19
+ dimension styles (which round-trip through the DXF `DIMSTYLE` table), list,
20
+ add, update and remove text styles (which round-trip through the DXF `STYLE`
21
+ table), list, add, update and remove line types (which round-trip through the
22
+ DXF `LTYPE` table) and assign a layer line type and lineweight, find and replace text content in bulk, collect entities into named
23
+ groups, select entities with a
24
+ rectangular window or crossing query, compute endpoint, midpoint, centre and
25
+ line-intersection snap points near a probe point, read and write title-block properties
26
+ (title, author, company, project, description and keywords), convert points and
27
+ entities between world and user coordinates, move entities in the paint order
28
+ (`to-front`, `to-back`, `forward`, `backward`), create, list, update and delete
29
+ paper-space layouts with a sheet size, plot scale and computed fit view, save
30
+ atomically, inspect units, layers,
31
+ geometry, polylines, dimensions, duplicate entities, zero-length geometry,
32
+ open contours and opted-in empty layers, report per-layer statistics, import
33
+ the declared ASCII DXF subset (including SPLINE,
34
+ LEADER, MLEADER, HATCH and 3D POLYLINE projection), and export SVG, ASCII DXF,
35
+ R12-compatible ASCII DXF, PDF, STL, OBJ or STEP.
36
+ The interactive viewport, the constraint solver, DWG/STEP import, a full DXF
37
+ reader and STL/OBJ import are not implemented. Those routes report
38
+ `capability/not-implemented`; do not present them as executable and do not
39
+ substitute local geometry, parser or drawing code.
40
+
41
+ ## Commands
42
+
43
+ Run these exact commands. Entity, layer and history commands open the file,
44
+ mutate it and save it back to the same path.
45
+
46
+ ```bash
47
+ open-cad capabilities
48
+
49
+ open-cad create --out plan.ocad --title "Site plan" --units mm
50
+ open-cad open plan.ocad
51
+
52
+ open-cad entity add-line plan.ocad --layer 0 --from 0,0 --to 100,40
53
+ open-cad entity add-point plan.ocad --layer 0 --at 10,10
54
+ open-cad entity add-circle plan.ocad --layer 0 --center 50,50 --radius 20
55
+ open-cad arc add plan.ocad --layer 0 --center 50,50 --radius 20 --start 0 --end 90
56
+ open-cad ellipse add plan.ocad --layer 0 --center 80,20 --rx 30 --ry 10 --rotation 15
57
+ open-cad entity add-polyline plan.ocad --layer 0 --points "0,0 100,0 100,60" --closed
58
+ open-cad entity add-text plan.ocad --layer 0 --at 5,5 --height 2.5 --text "Site plan"
59
+ open-cad entity add-dimension plan.ocad --layer dimensions --from 0,0 --to 100,0 --offset 10
60
+ open-cad entity add-radial-dimension plan.ocad --layer dimensions --center 50,50 --radius 20 --angle 45 --offset 3
61
+ open-cad entity add-radial-dimension plan.ocad --layer dimensions --center 50,50 --radius 20 --angle 0 --diameter
62
+ open-cad entity add-ordinate-dimension plan.ocad --layer dimensions --origin 0,0 --feature 50,20 --axis x --offset 10
63
+ open-cad entity add-hatch plan.ocad --layer fills --points "0,0 80,0 80,60 0,60" --pattern ANSI31
64
+ open-cad entity move plan.ocad --id entity-1 --dx 10 --dy 5
65
+ open-cad entity update plan.ocad --id entity-3 --text "Hall" --height 3
66
+ open-cad entity update plan.ocad --id entity-2 --radius 25
67
+ open-cad entity delete plan.ocad --id entity-1
68
+ open-cad entity list plan.ocad
69
+
70
+ open-cad transform plan.ocad --ids entity-1,entity-2 --rotate 45 --center 0,0
71
+ open-cad transform plan.ocad --layer 0 --translate 10,5
72
+ open-cad transform plan.ocad --all --scale 2 --center 0,0
73
+ open-cad transform plan.ocad --all --mirror x --mirror-at 0
74
+ open-cad copy plan.ocad --ids entity-1 --dx 10 --dy 0 --count 3
75
+ open-cad array plan.ocad --ids entity-1 --rows 2 --columns 3 --row-spacing 10 --column-spacing 10
76
+ open-cad array plan.ocad --ids entity-1 --center 0,0 --count 6 --angle 360
77
+ open-cad explode plan.ocad --id entity-2
78
+ open-cad offset plan.ocad --id entity-2 --distance 2
79
+ open-cad fillet plan.ocad --first entity-1 --second entity-2 --radius 5
80
+ open-cad chamfer plan.ocad --first entity-1 --second entity-2 --distance-a 3 --distance-b 3
81
+ open-cad measure plan.ocad
82
+ open-cad measure plan.ocad --ids entity-1,entity-2
83
+ open-cad measure-points plan.ocad --points "0,0 3,4"
84
+ open-cad measure-points plan.ocad --points "0,10 0,0 5,0"
85
+ open-cad stats plan.ocad
86
+
87
+ open-cad undo plan.ocad
88
+ open-cad redo plan.ocad
89
+
90
+ open-cad layer add plan.ocad --name Walls --color "#a4262c"
91
+ open-cad layer rename plan.ocad --name Walls --to Structure
92
+ open-cad layer merge plan.ocad --from Walls --to Structure
93
+ open-cad layer visible plan.ocad --name Structure --visible off
94
+ open-cad layer lock plan.ocad --name Structure --locked on
95
+ open-cad layer freeze plan.ocad --name Structure --frozen on
96
+ open-cad layer plot plan.ocad --name Structure --plottable off
97
+ open-cad layer set plan.ocad --name Structure --linetype DASHED --lineweight 0.5
98
+ open-cad layer delete plan.ocad --name Structure
99
+
100
+ open-cad linetype list plan.ocad
101
+ open-cad linetype add plan.ocad --name DASHED --description "Dashed" --pattern 5,2
102
+ open-cad linetype update plan.ocad --name DASHED --to DASH-1 --pattern 6,2
103
+ open-cad linetype delete plan.ocad --name DASH-1
104
+
105
+ open-cad dimstyle list plan.ocad
106
+ open-cad dimstyle add plan.ocad --name ARCH --scale 2.5 --arrow-size 3 --text-height 3.5 --precision 2
107
+ open-cad dimstyle update plan.ocad --name ARCH --to ARCH-1 --scale 3
108
+ open-cad dimstyle delete plan.ocad --name ARCH-1
109
+
110
+ open-cad textstyle list plan.ocad
111
+ open-cad textstyle add plan.ocad --name NOTES --font romans.shx --width-factor 0.8 --oblique 10
112
+ open-cad textstyle update plan.ocad --name NOTES --to NOTES-1 --height 3
113
+ open-cad textstyle delete plan.ocad --name NOTES-1
114
+
115
+ open-cad text find plan.ocad --pattern hall
116
+ open-cad text replace plan.ocad --pattern hall --to "main hall"
117
+
118
+ open-cad group list plan.ocad
119
+ open-cad group create plan.ocad --name Walls --ids entity-1,entity-2
120
+ open-cad group add plan.ocad --name Walls --ids entity-3
121
+ open-cad group remove plan.ocad --name Walls --ids entity-3
122
+ open-cad group delete plan.ocad --name Walls
123
+
124
+ open-cad select plan.ocad --box 0,0,100,100
125
+ open-cad select plan.ocad --box 0,0,100,100 --crossing --layer Walls
126
+ open-cad snap plan.ocad --modes endpoint,midpoint,center,intersection --near 10,0 --tolerance 5
127
+
128
+ open-cad properties show plan.ocad
129
+ open-cad properties set plan.ocad --title "Harbour plan" --author "Design team" --company OpenCAD
130
+
131
+ open-cad units convert plan.ocad --to inch
132
+
133
+ open-cad ucs plan.ocad --origin 10,0 --rotation 90 --direction to-world --points "0,0 10,0"
134
+ open-cad ucs plan.ocad --origin 0,0 --rotation 30 --direction to-ucs --ids entity-1,entity-2
135
+
136
+ open-cad inspect plan.ocad --checks units,layers,geometry,polylines,dimensions,duplicate-entity,zero-length,open-contour
137
+ open-cad export plan.ocad --format svg --out plan.svg
138
+ open-cad export plan.ocad --format dxf --out plan.dxf
139
+ open-cad export plan.ocad --format dxf-r12 --out plan-r12.dxf
140
+ open-cad export plan.ocad --format pdf --out plan.pdf
141
+ open-cad export plan.ocad --format stl --out plan.stl
142
+ open-cad export plan.ocad --format obj --out plan.obj
143
+ open-cad export plan.ocad --format step --out plan.step
144
+ open-cad import site.dxf --out site.ocad
145
+ ```
146
+
147
+ `--out` on `create` and `import` refuses to replace an existing file unless
148
+ `--overwrite` is given. `--format` accepts the declared targets; `svg`, `dxf`,
149
+ `dxf-r12`, `pdf`, `stl`, `obj` and `step` are implemented. `dxf-r12` always
150
+ writes `AC1009`, simplifies ellipses and hatches to boundary polylines, and
151
+ reports omitted `$INSUNITS`, lineweight and plot flags. STL, OBJ and STEP are
152
+ export-only: they extrude closed polylines along +Z and do not read STL/OBJ/STEP,
153
+ model surfaces or run boolean operations. OBJ writes the same extrusion as
154
+ `v`/`f` mesh records. STEP writes ISO-10303-21 AP203-style text as a faceted
155
+ BREP (`MANIFOLD_SOLID_BREP`); open profiles are skipped with
156
+ `step/open-profile`.
157
+
158
+ `entity move` takes either `--dx/--dy` or `--to x,y`, never both. A locked layer
159
+ refuses add, move, update, transform, copy, array, explode, offset and delete
160
+ with `drawing/layer-locked`; a frozen layer refuses the same writes with
161
+ `drawing/layer-frozen`.
162
+
163
+ `transform` needs exactly one selection (`--ids a,b`, `--layer id` or `--all`)
164
+ and exactly one operation (`--translate dx,dy`, `--rotate degrees --center x,y`,
165
+ `--scale factor --center x,y`, or `--mirror x|y --mirror-at <number>`). Mirror
166
+ `x` reflects across `y = at` and mirror `y` across `x = at`. `copy` takes
167
+ `--ids`, `--dx`, `--dy` and `--count` (1-10000) and returns the fresh ids.
168
+ `array` takes `--ids` and exactly one placement: either `--rows/--columns` with
169
+ optional `--row-spacing/--column-spacing`, or
170
+ `--center x,y --count --angle degrees`. The source stays at its own position, so
171
+ a rectangular grid creates `rows * columns - 1` copies and a polar array
172
+ `count - 1` copies; both return the fresh ids. `explode` takes `--id` of one
173
+ polyline and replaces it, at the same list position, with one line per edge
174
+ (closed polylines gain the closing edge). `offset` takes `--id` of one circle,
175
+ arc, polyline or line and `--distance`; it appends a new entity on the same layer
176
+ without moving the source. A positive distance grows a radius or offsets an
177
+ open polyline or line to the left of its travel direction; a negative distance
178
+ shrinks or offsets right. Closed polylines miter every vertex. Text, point,
179
+ ellipse and dimension entities are refused with `object/unsupported`, and a
180
+ non-positive resulting radius or a zero-length line with
181
+ `session/argument-invalid`. `fillet` takes `--first`,
182
+ `--second` and `--radius`; `chamfer` takes `--first`, `--second`,
183
+ `--distance-a` and optional `--distance-b` (which defaults to the first
184
+ distance). Both require two different line entities, use the closest endpoint
185
+ pair as the corner, trim both lines towards their far endpoints and append the
186
+ new arc or bevel line on the first line's layer. A radius or distance that
187
+ does not fit on both segments, parallel or collinear lines, and zero-length
188
+ lines are refused with `session/argument-invalid`; other entity types with
189
+ `object/unsupported`. `measure` reports bounds, width,
190
+ height, entity count, path length and enclosed area: ellipse length is sampled at
191
+ five-degree steps and area only covers closed polylines, full circles and full
192
+ ellipses. `measure --ids a,b` applies the same rules per entity, reports
193
+ `length`, `area` and `closed` for each one plus totals, and refuses an unknown id
194
+ with `object/not-found`; a closed polyline reports its perimeter as `length`.
195
+ `stats` applies the same rules per layer and adds per-layer entity
196
+ counts plus drawing-wide totals. `measure-points --points "x,y x,y"` reports the
197
+ distance, signed `dx`/`dy` and a degree bearing; with three points the middle one
198
+ is the angle vertex and the response reports the angle between the legs plus both
199
+ leg lengths and the span. A repeated vertex is refused with
200
+ `session/argument-invalid`. The `empty-layer` inspection check is opt-in:
201
+ `inspect --checks empty-layer` warns about each layer with no entities, and a
202
+ default inspection run does not include it.
203
+
204
+ Layer `frozen` and `plottable` flags are part of every layer update. Frozen layers
205
+ are skipped by SVG and PDF output and refuse writes with
206
+ `drawing/layer-frozen`; non-plottable layers are omitted from plots. The DXF
207
+ `LAYER` table writes freeze as code 70 flag 1 and plot as code 290 (using
208
+ `AC1015`), and both flags are read back on import.
209
+
210
+ `ucs` converts between world coordinates and a user coordinate system given by
211
+ `--origin x,y` and `--rotation` degrees. `--direction to-world` maps UCS values
212
+ into world coordinates; `to-ucs` maps world values into the UCS. `--points`
213
+ converts values without a history step, while `--ids` applies the same rotation
214
+ and translation to entities in one history step and refuses locked or frozen
215
+ layers. Named UCS entries and a rotated view are not modelled.
216
+
217
+ `text find` is a read-only query over `TEXT` entities and `text replace` is one
218
+ history step. Both match ASCII case-insensitively unless `--match-case` is
219
+ passed, accept `--layer` to narrow the scope, and never touch dimension labels
220
+ or attributes. A replacement on a locked or frozen layer refuses the whole edit
221
+ with `drawing/layer-locked` or `drawing/layer-frozen`.
222
+
223
+ Entity groups are named membership lists stored in the `.ocad` document; the
224
+ DXF `GROUP` table is not read or written. `group create` needs `--name` and
225
+ `--ids`, `group add`/`group remove` change membership, and `group delete`
226
+ removes the group. Group membership never changes geometry, and deleting or
227
+ exploding a member removes its id from every group.
228
+
229
+ `undo` and `redo` use the `<file>.history.json` sidecar that every mutating
230
+ command maintains (up to 32 prior documents, atomic writes), so they work across
231
+ separate CLI processes. Restoring a snapshot bumps the revision relative to the
232
+ current file. An empty sidecar reports `drawing/nothing-to-undo` or
233
+ `drawing/nothing-to-redo`. `create` and `import` clear stale history because they
234
+ start a new document.
235
+
236
+ ## Drawing model
237
+
238
+ - A `.ocad` file is UTF-8 JSON tagged `open-cad-drawing`, version `1`.
239
+ - Units are `mm` or `inch`. `units convert --to mm|inch` scales every length by
240
+ 25.4 or 1 / 25.4 and changes the declared unit. Explicit dimension labels are
241
+ kept as text, so a label that conflicts with the new unit is still reported by
242
+ the `units` check.
243
+ - Every drawing starts with layer `0` (colour `#d0d7de`) and layer `dimensions`
244
+ (colour `#0b7285`).
245
+ - Entity ids are deterministic: `entity-1`, `entity-2`, ... and are never
246
+ reused after a delete.
247
+ - Entities are `line`, `circle`, `arc`, `ellipse`, `point`, `polyline`, `text`,
248
+ `dimension` (linear), `radial_dimension`, `ordinate_dimension` and `hatch`. A
249
+ radial
250
+ dimension stores a centre, radius, an angle locating the measured point and a
251
+ leader offset; `diameter` switches the measured value from radius to diameter.
252
+ An ordinate dimension stores a datum origin, a feature point, an `x` or `y`
253
+ axis and a perpendicular offset. A hatch stores one closed boundary polygon
254
+ and a pattern name (`SOLID` for a solid fill); the pattern is a description,
255
+ not a rendered pattern definition. Arcs store centre, radius and
256
+ counter-clockwise start/end degrees. Ellipses store centre, `rx`/`ry`, a
257
+ major-axis rotation and start/end parameters measured from that axis.
258
+ - The revision increments on every mutation. Save does not change it, so a
259
+ reopened file keeps the revision it was written with.
260
+ - Each handle keeps up to 32 snapshots. Every mutation adds one step; open and
261
+ create start empty; save does not add a step. Undo and redo restore a snapshot
262
+ and bump the revision.
263
+ - Layers are unique by name. Renaming a layer also rewrites every entity
264
+ reference in the same mutation. `layer merge --from A --to B` moves every
265
+ entity of `A` onto `B`, removes the empty `A` and is one history step. Locked
266
+ and frozen layers refuse writes; hidden and frozen layers are skipped by the
267
+ exporters, and non-plottable layers are skipped by the plot outputs.
268
+ - Dimension styles are unique by name and a drawing always keeps at least one.
269
+ Each style stores the overall scale, arrowhead size, text height, extension
270
+ line length, origin offset and decimal places; those variables are read from
271
+ and written to the DXF `DIMSTYLE` table. Other DIMSTYLE variables and a
272
+ per-dimension style reference are not modelled.
273
+ - Text styles are unique by name and a drawing always keeps at least one. Each
274
+ style stores a primary font, fixed height, width factor and oblique angle;
275
+ those variables round-trip through the DXF `STYLE` table. Big-font and
276
+ generation flags, and a per-text style reference, are not modelled.
277
+ - Line types are unique by name and a drawing always keeps at least one. Each
278
+ stores a description and a dash pattern in drawing units; an empty pattern is
279
+ solid. Layers carry a line type id and a lineweight in millimetres (0-10).
280
+ Both round-trip through the DXF `LTYPE` and LAYER tables; SVG and PDF ignore
281
+ dash patterns and lineweight, and per-entity overrides are not modelled.
282
+ - Drawing properties store the title-block metadata (title, author, company,
283
+ project, description and keywords) in the `.ocad` document. Values are
284
+ trimmed, an empty value clears the field and each value is limited to 512
285
+ characters; the DXF header and title-block geometry are not written.
286
+ - Entity groups are unique by name and keep member ids in insertion order.
287
+ Grouping is metadata: it never changes geometry, layers or entity revisions.
288
+ A group may become empty after removals; deleting or exploding a member drops
289
+ that id from every group.
290
+ - Draw order is the explicit paint sequence stored beside the entities. An empty
291
+ sequence keeps the layer-first order. `reorderEntity()` with `to-front`,
292
+ `to-back`, `forward` or `backward` rewrites the sequence, and SVG, PDF and
293
+ DXF output paint entities in that order. Deleting an entity drops its id, and
294
+ exploding a polyline replaces its id with the generated line ids at the same
295
+ position.
296
+ - Paper-space layouts are named sheets stored in the `.ocad` document. Each one
297
+ keeps a width and height in millimetres plus a scale in paper units per
298
+ drawing unit (`1` is 1:1). `listLayouts()` also reports the model extents
299
+ centre, the visible drawing-unit size, whether the model fits and the scale
300
+ that would fit it. Layouts do not move or clip geometry, and no layout data
301
+ is written to DXF or PDF.
302
+ - `select --box x1,y1,x2,y2` is a read-only query: `window` (the default) keeps
303
+ entities fully inside the rectangle, `--crossing` also keeps entities that
304
+ cross or touch it, and `--layer` narrows the result. Curves are tested against
305
+ sampled outlines; hidden, frozen and locked layers stay selectable.
306
+ - `snap --near x,y` is a read-only query over `endpoint`, `midpoint`, `center`
307
+ and `intersection` candidates. `--modes` narrows the kinds, `--tolerance`
308
+ keeps only candidates within that distance of `--near`, and `--layer`/`--ids`
309
+ narrow the entities. Intersections are computed between two straight lines
310
+ only; candidates are sorted by distance and capped at 1000.
311
+ - `open-cad import` builds a new drawing from the declared ASCII DXF subset:
312
+ `$INSUNITS`, the LAYER, LTYPE, STYLE and DIMSTYLE tables, BLOCKS/INSERT expansion, and LINE, CIRCLE, ARC,
313
+ ELLIPSE, POINT, TEXT, LWPOLYLINE (bulge sampled as arcs),
314
+ POLYLINE/VERTEX/SEQEND (3D polylines are projected onto the XY plane), SPLINE
315
+ (a polyline through the fit points, or the control polygon when there are no
316
+ fit points), LEADER (an open polyline), MLEADER (leader vertices as an open
317
+ polyline plus one TEXT entity per inline text line) and HATCH (one closed
318
+ boundary path made of line, arc or polyline edges as a filled polygon, while
319
+ elliptical or spline boundary edges skip the entity). Rotated or aligned
320
+ linear, radial, diameter and ordinate DIMENSION references are read. ARC and
321
+ ELLIPSE stay analytic; only polyline bulge arcs are flattened. Angular
322
+ dimensions are reported as `dxf/unsupported-entity`, MLEADER formatting is
323
+ removed, and every approximation is reported with its own notice code. The
324
+ import result carries `losses` as `{ code, severity, detail }`.
325
+
326
+ ## Inspection
327
+
328
+ The implemented checks are `units`, `layers`, `geometry`, `polylines`,
329
+ `dimensions`, `duplicate-entity`, `zero-length` and `open-contour`. `units` only
330
+ warns when a dimension label carries an explicit unit word or inch symbol that
331
+ conflicts with the document unit. `duplicate-entity` reports entities whose
332
+ layer and geometry are identical; `zero-length` reports lines whose ends
333
+ coincide and polylines whose whole length collapses to one point;
334
+ `open-contour` reports chains of two or more lines or open polyline segments
335
+ that do not close back on themselves (vertices within one millionth of a
336
+ drawing unit count as joined).
337
+ Findings carry a code, severity, revision, layer id, object id, recoverability
338
+ and message. A drawing without error-level findings passes; a locked-layer
339
+ finding is a warning.
340
+
341
+ Reported findings include duplicate entity ids, entities on a missing layer,
342
+ zero-length lines, non-positive circle/arc radii and ellipse axes, duplicated
343
+ identical entities, polylines with fewer than two points or that are open,
344
+ repeated polyline vertices (zero-length segment), non-finite coordinates,
345
+ dimensions with identical endpoints or an empty label, radial dimensions with a
346
+ non-positive radius, ordinate dimensions measuring zero distance, empty text,
347
+ duplicate layer names, and geometry on a hidden, frozen or locked layer. `passed` is false only
348
+ when an error-level finding exists.
349
+
350
+ `constraints` and `references` are not implemented. Requesting them fails with
351
+ `capability/not-implemented` instead of a false pass.
352
+
353
+ ## Preflight
354
+
355
+ 1. Run `open-cad capabilities` and confirm the export target and checks the task
356
+ needs. A target listed as `unsupported` must not be promised. `dxf` is
357
+ `partial` because only a declared subset imports.
358
+ 2. Confirm the unit convention, the layer needed and the source file before
359
+ editing. Create the layer with `layer add` or adding an entity to an unknown
360
+ layer fails with `object/not-found`. A locked or frozen layer fails writes
361
+ with `drawing/layer-locked` or `drawing/layer-frozen`.
362
+ 3. If a required route is unsupported, stop and report it. Never degrade
363
+ silently or swap in an unrelated tool.
364
+
365
+ ## Routes
366
+
367
+ | Route | Intent | Evidence |
368
+ |-------|--------|----------|
369
+ | create | Build an empty drawing, then add measured entities | reopened file, revision, inspection report |
370
+ | edit | Change an existing drawing without losing layer or revision identity | moved/updated entity, undo/redo report, saved file, inspection report |
371
+ | review | Audit units, layers, geometry and dimensions | per-check findings with layer/object locators |
372
+ | deliver | Export SVG, DXF or PDF | written file, loss report, remaining limitations |
373
+ | import | Read a declared ASCII DXF subset into a new drawing | imported entity/layer counts, warnings, reopened file |
374
+
375
+ ## Hard rules
376
+
377
+ - Never export a drawing whose layers are flattened or whose data was altered to
378
+ dodge a fidelity problem.
379
+ - Never claim a check ran when it did not, and never fabricate a rendered view.
380
+ The studio viewport is not implemented; SVG, DXF and PDF output is the visual
381
+ deliverable today.
382
+ - Describe DXF import as the declared subset only. Do not claim a full DXF
383
+ reader, and do not describe STEP, STL, OBJ, PNG or the constraint solver as
384
+ working.
385
+ - Another CAD application may serve only as an optional independent verification
386
+ source. The workflow must not require one.
387
+
388
+ ## Safety
389
+
390
+ - Confirm with the user before any command that writes or overwrites a drawing
391
+ file, and state the target path first.
392
+ - Entity commands save in place. Copy the source file before a destructive edit
393
+ unless the user asked for in-place changes.
394
+ - Never delete or re-encode source drawings without explicit confirmation.
395
+
396
+ ## References
397
+
398
+ - `../../../../crates/cad-model` — document store, persistence, history,
399
+ inspection, layer/entity editing and import entry points.
400
+ - `../../../../crates/cad-model` — ASCII DXF subset reader.
401
+ - `../../../../crates/cad-model` — SVG, DXF and PDF writers.
402
+ - `../../../../crates/cad-model` — drawing, layer and entity schema.
403
+ - `projects/packages/open-cad/src/document.ts` — SDK document wrapper.