Sebastian
d1b8fc93f5
ocs_doc_api: convert architecture flow diagram to readable text format
...
Replace the mermaid flowchart (hard to read raw) with a clean ASCII/text diagram
tracing the same flow from the single source of truth (spec/entities.toml +
layouts.json) through codegen, facade, wire, transport, executor, and the host
backend/Scene, plus a layer-by-layer legend.
2026-09-06 16:34:39 +02:00
Sebastian
0965e188c9
ocs_doc_api: enrich + update all documentation (architecture flow diagram, guarantees, counts)
...
- ARCHITECTURE.md: add 'Flow: from the single source of truth to a committed
change' mermaid diagram (spec/entities.toml + layouts.json -> codegen -> facade
-> wire -> transport -> executor -> host backend/Scene); fix stale claims
(hand-maintained enums not 'GENERATED'; accuracy-first mass properties + Scene
cold-tess budget; with_body borrow; tab auth); add Review round 3 change-log;
update Known deviations.
- README.md: Core guarantees now include Loft/query caps, accurate mass properties
(Scene budget persists + graceful fallback), and tab authorization.
- IMPLEMENTATION.md: accuracy paragraph (Scene budget + fallback) + current test
counts (623 host lib + 8 crate + 3 consistency + 34 plugin_api).
- Regenerate api_reference.md (26 sections) + binding_schema.json (28 ops / 12
queries / 14 handles / 19 families).
- 623 host lib + 8 crate + 3 consistency + 34 plugin_api green.
2026-09-06 16:23:33 +02:00
Sebastian
919128e087
ocs_doc_api: fix branch-review findings (tab auth, bulge center, budget, caps, dead code)
...
CRITICAL:
- execute_doc_api: reject tab_id != bound tab (confused deputy); test
doc_api_tab_mismatch_is_rejected.
- bulge_arc_segment: fix negative/CW bulge center (apothem magnitude + sign picks
side; was double-sign-mirrored); test CW-vs-CCW center offset.
- cold-tess budget: move mass_cache/cold_tess_used to per-tab Scene so the budget
persists across DocApi dispatches (was reset per request); budget-exhausted ->
approximate meshes.metrics fallback instead of error.
WARNING:
- Loft: add BULK_ITEM_CAP (was uncapped -> unbounded kernel call from one request).
- CreateMany: pre-validate EntitySpec::Curve (ellipse ratio) in prepare phase ->
all-or-nothing restored; regression test.
- Partial Ellipse: offset start/end_parameter by rot_z on rotation; regression test.
- resolve_body: add with_body borrow accessor (host overrides to borrow cache in
place, O(1)); bounds() uses it instead of deep-cloning the B-rep per query.
- add_raster_image: validate file path (non-empty, image extension, reject
UNC/traversal); regression test.
SUGGESTION:
- deploy: bump API_VERSION 5 -> 6 so DocApi plugins are gated at handshake on old
hosts (append-only wire + defaulted method keep old V2-V5 plugins loading).
- dead code: wire query_name into apply_queries error labels; host uses crate's
ObjectId::from_handle/to_handle (drop local duplicates); delete is_null/backend_mut.
- mock drift: test mock now stores curve specs + computes curve bounds (aligns with
example mock); Spline/Dimension bounds delegate to points_aabb.
623 host lib + 8 crate + 3 consistency + 34 plugin_api green.
2026-09-06 16:03:34 +02:00
Sebastian
ac54d6079b
ocs_doc_api: fix review findings (layouts, Helix bounds, points_aabb, mass-properties budget, docs)
...
- layouts.json: append the 6 missing ops (CreateDimensionRadius/Diameter/Angular,
CreateAttributeDefinition, CreateTable, CreateDimensionAngular2Ln); regenerate
binding_schema.json + api_reference.md wire vocabulary (all 28 ops).
- Helix bounds: bound the evaluated spline control polygon (was a degenerate
single-start-point AABB).
- points_aabb: empty -> Geometry::Empty('entity has no points to bound'), not
UnknownId (the entity exists; don't misclassify as stale/deleted).
- mass_properties: accuracy-first fine tessellation + graceful degradation to the
approximate meshes.metrics value when the cold-tess budget is exhausted (large
distinct-solid batches no longer hard-fail).
- IMPLEMENTATION.md: Volume/Centroid rows + accuracy paragraph + test count (618)
consistent with the final design.
- 618 host lib + 8 crate + 3 consistency green.
2026-09-06 14:23:00 +02:00
Sebastian
28c8e0ef1a
ocs_doc_api: read-mostly family bounds (Leader/Mesh/Face3D/MLine/Helix)
...
- entity_bounds: vertex/point-carrying read-mostly families (Leader.vertices,
Mesh.vertices, Face3D 4 corners, MLine vertex positions, Helix start point)
via a points-to-AABB helper. Region/Body/Surface/MultiLeader stay Unsupported.
- IMPLEMENTATION.md: read-mostly bounds done.
- Test read_mostly_family_bounds_leader_and_mesh -> 618 host lib green.
2026-09-06 13:46:41 +02:00
Sebastian
6997dfe618
ocs_doc_api: accurate GetVolume/GetCentroid via fine tessellation
...
- mass_properties: query path now uses fine mesh_body(0.1, 1e-4) for near-analytic
volume/centroid; the render-mesh metrics cache (coarse display LOD) no longer
shadows query accuracy. Memoized per (handle, epoch); cold-tess budget kept.
- IMPLEMENTATION.md: accuracy item done.
- Test accurate_volume_centroid_sphere_and_cube (sphere within 0.5% of 4/3*pi*r^3,
centroid at centre, cube exact) -> 617 host lib green.
2026-09-06 13:40:07 +02:00
Sebastian
612e8e13e0
ocs_doc_api: Phase 2c-iii — 2-line angular dimension (all dimension sub-types done)
...
- CreateDimensionAngular2Ln(DimensionAngularSpec) op (append-only).
- backend add_dimension_angular2ln (DimensionAngular2Ln::new computes angle).
- facade create_dimension_angular2ln; spec constructor; api_reference + binding_schema
regenerated; mocks + baseline.
- IMPLEMENTATION.md: fix stale Status line (all 5 phases complete, current test
counts); mark all dimension sub-types done.
- Test phase2ciii_dimension_angular2ln (90-degree 2-line angle) -> 616 host lib +
3 consistency green.
2026-09-06 13:24:25 +02:00
Sebastian
240831edcd
ocs_doc_api: Phase 5-ii — typed Table create
...
- CreateTable(TableSpec{insertion_point, data[row][col]}) op (append-only).
- backend add_table via Table::new(insertion_point, rows, cols) + set_cell_text
(Table::default() pre-creates 3x3, so use Table::new for exact dims).
- executor validates non-empty rectangular grid; facade create_table.
- spec Table constructor; api_reference + binding_schema regenerated; mocks + baseline.
- Test phase5ii_create_table_from_grid (3x2 grid, non-rectangular rejected)
-> 615 host lib + 3 consistency green. Phase 5 complete.
2026-09-06 13:02:21 +02:00
Sebastian
f8ae54a351
ocs_doc_api: Phase 3-ii — typed AttributeDefinition create (Phase 3 complete)
...
- CreateAttributeDefinition(AttributeDefinitionSpec) op (append-only).
- backend add_attribute_definition (ATTDEF tag/prompt/default/insertion/height/rotation).
- facade create_attribute_definition; entity_kind_name AttributeDefinition/AttributeEntity.
- spec AttributeDefinition family; api_reference + binding_schema regenerated; mocks + baseline.
- Test phase3ii_create_attribute_definition -> 614 host lib + 3 consistency green.
2026-09-06 12:43:34 +02:00
Sebastian
8d8c120880
ocs_doc_api: Phase 2c-ii — dimension sub-types (radius/diameter/angular)
...
- CreateDimensionRadius/CreateDimensionDiameter (DimensionRadialSpec) +
CreateDimensionAngular (DimensionAngularSpec) ops (append-only).
- backend add_dimension_radius/diameter (DimensionRadius/DimensionDiameter::new)
+ add_dimension_angular (DimensionAngular3Pt::new computes angle);
dimension_measurement returns degrees for angular sub-types.
- facade create_dimension_radius/diameter/angular; spec constructors; api_reference
+ binding_schema regenerated; mocks + baseline.
- Test phase2cii_dimension_radius_diameter_angular -> 613 host lib + 3 consistency green.
2026-09-06 12:31:23 +02:00
Sebastian
2522979285
ocs_doc_api: enrich API reference generator
...
api_reference.md now includes (regenerated from spec + layouts.json):
- Wire vocabulary section: every Operation (22) + Query (12) variant with payloads.
- Errors section: ApiError variant table.
- Envelope & transport section: DocApiEnvelope framing, Receipt, transports.
- Method/constructor lines now show fixed fields (e.g. SolidBoolean erase_sources
+ op value) and clean zero-arg () rendering.
Generator: fmt_fixed/fmt_call_args helpers; reads layouts.json for the wire vocab.
612 host lib + 8 crate + 3 consistency green.
2026-09-06 11:35:23 +02:00
Sebastian
a9c278e32a
ocs_doc_api: update docs + fix review-drift findings
...
- lib.rs: export all 14 facade handles (add ArcCurve/Ellipse/Spline/Ray/XLine/Text/
MText/Dimension + Circle) — public surface matches collection return types.
- build.rs: fix step-1 comment (enums are hand-maintained, not 'regenerated');
generic_reference_md: Clone (not Copy) + full 14-handle list (was stale 6).
- ops.rs/query.rs: correct 'hand-maintained' module doc comments (were 'GENERATED').
- layouts.json: extend to all 22 Operation + 12 Query variants (was stale phase-1).
- binding_schema.json regenerated (complete layouts + derived handles).
- generate.py: inject 'id': self.id for SetTextContent/SetAttribute/SetViewportView/
Transform/Delete/AddVertex (was malformed id-less payloads); _apply_op/_apply_query
accept want=None; extend PY_TYPES (String/&str/Vec returns/new handles).
- README.md: Clone (not Copy) + full scope (2D curves, annotations, containers,
viewports, media) replacing stale 'Not yet' list.
- Plan (.kilo): mark implemented & published; pointer to live crate docs.
2026-09-06 11:22:01 +02:00
Sebastian
8417375e5a
ocs_doc_api: fix stray impl-closing brace in both mock backends
...
The loft/attributes/viewport mock methods were appended after the impl block's
closing brace, orphaning add_vertex..finalize_op and leaving a duplicate brace.
Move the impl close to the true end in both tests/mock_backend.rs and
examples/common/mod.rs. Crate tests (8) + examples compile green again.
2026-09-06 10:55:36 +02:00
Sebastian
e216a7bf94
ocs_doc_api: outstanding methods — loft + bulge-arc polyline profiles
...
- Loft{profiles} op (append-only); executor resolves each profile to curve sets
all-or-nothing; backend loft() -> brep::loft on XY plane; facade solids().loft.
- entity_to_profile_curves: convert LwVertex.bulge to geom2d::Curve::Arc via
bulge_arc_segment (theta = 4*atan(bulge)), so bulged polyline profiles sweep
correctly instead of erroring Unsupported.
- spec loft; api_reference + binding_schema regenerated; mocks + baseline.
- Tests: loft_two_profiles_produces_solid, bulge_arc_polyline_profile_converts_to_arc
(semicircle radius=5 for bulge=1) -> 612 host lib + 3 consistency green.
2026-09-06 10:44:37 +02:00
Sebastian
46a5922520
ocs_doc_api: Phase 5 typed raster image create
...
- CreateRasterImage(RasterImageSpec) op (append-only).
- backend add_raster_image (RasterImage with file_path/insertion/u/v/size; the
scene auto-registers the ImageDefinition on add_entity).
- facade create_raster_image; spec RasterImage constructor; api_reference +
binding_schema regenerated; mocks + baseline.
- Test phase5_create_raster_image_registers_definition (asserts definition_handle
auto-registered + 4-corner bounds) -> 610 host lib + 3 consistency green.
- Phase 5 complete.
2026-09-06 10:28:51 +02:00
Sebastian
e6c132e0eb
ocs_doc_api: Phase 4 set_view + viewport-view query
...
- SetViewportView op + GetViewportView query (append-only).
- backend set_viewport_view (update Viewport.view_target/view_height) + viewport_view.
- facade Entity::set_view/viewport_view (Viewport returns Entity).
- spec Viewport methods; api_reference + binding_schema regenerated; mocks + baseline.
- Test phase4_set_view_and_view_query -> 609 host lib + 3 consistency green.
- Phase 4 complete.
2026-09-06 10:16:27 +02:00
Sebastian
67655add72
ocs_doc_api: Phase 3 attributes + nested block traversal
...
- SetAttribute op + GetAttributes/GetBlockEntities queries (append-only).
- backend set_attribute (add/update Insert attribute), attributes (tag,value pairs),
block_entities (read-only traversal via BlockRecord.entity_handles -> id+kind+bounds).
- facade Entity::set_attribute/attributes, Document::block_entities.
- spec Insert methods; api_reference + binding_schema regenerated; mocks + baseline.
- Query enum: drop Copy (GetBlockEntities carries String).
- Test phase3_attributes_and_block_traversal -> 608 host lib + 3 consistency green.
2026-09-06 10:02:23 +02:00
Sebastian
2dba0158ca
ocs_doc_api: Phase 2b-c (linear Dimension) — Phase 2 complete
...
- CreateDimensionLinear(DimensionSpec) op + GetDimensionMeasurement query (append-only).
- backend add_dimension_linear (Dimension::Linear via DimensionLinear::new) +
dimension_measurement (linear/radius/diameter distance).
- Dimension bounds from measured + definition points; Dimension handle + measurement().
- spec Dimension family; api_reference + binding_schema regenerated; mocks + baseline.
- Test phase2c_dimension_linear_create_measurement_bounds -> 607 host lib + 8 crate
+ 3 consistency green. Phase 2 (full 2D + annotations) is now complete.
2026-09-06 09:43:37 +02:00
Sebastian
ba8e5ed0cd
ocs_doc_api: Phase 2b-b (Hatch)
...
- CreateHatch(HatchSpec) op + GetHatchBoundary query (append-only).
- HatchSpec{boundary: Vec<[f64;2]>, solid}; executor validates >= 3 boundary points.
- backend add_hatch (Line-edge BoundaryPath, solid/pattern) + hatch_boundary
(reconstruct loops from Line edges; non-line edges -> Unsupported).
- Hatch bounds from boundary edges; facade create_hatch + Entity handle.
- spec Hatch family; api_reference + binding_schema regenerated; mocks + baseline.
- Test phase2b_hatch_create_boundary_bounds_delete -> 606 host lib + 8 crate + 3 consistency green.
2026-09-06 09:24:11 +02:00
Sebastian
fc0e2c2c9d
ocs_doc_api: Phase 2b-a (Text/MText annotations)
...
- CreateText/CreateMText/SetTextContent ops + GetTextContent query (append-only).
- backend add_text/add_mtext/set_text_content/text_content (Text.value/MText.value).
- facade create_text/create_mtext + Text/MText handles with content()/set_content().
- Text/MText coarse bounds + transform (insertion point); ensure_transformable.
- spec Text/MText families; api_reference + binding_schema regenerated; mocks.
- can_modify backend hook (exists + not-locked) for SetTextContent validation.
- consistency baseline extended with the appended variants.
- Test phase2b_text_mtext_create_content_transform -> 605 host lib + 3 consistency green.
2026-09-06 09:07:41 +02:00
Sebastian
1925a83a25
ocs_doc_api: spec<->wire consistency + append-only baseline tests
...
Add tests/spec_wire_consistency.rs: (a) every op/query name in spec/entities.toml
maps to an existing Operation/Query variant; (b) both enums are append-only
relative to a recorded variant-order baseline (bincode discriminant stability).
Adds toml to dev-dependencies. 3 tests green.
2026-09-06 08:44:53 +02:00
Sebastian
c74504f30c
ocs_doc_api: fix review findings (scale/rotation/all-or-nothing/DoS/bounds/codegen)
...
CRITICAL:
- transform_entity_geometry: fix s^2 double-scale (axes already carry scale; drop
the *s pre-multiply so 2D entities scale by s like solids), and handle rotation
for direction/angle fields (apply_dir for Ray/XLine direction + Ellipse
major_axis; offset Arc angles; compose Insert rotation).
- ensure_transformable: check layer-lock + resolve solid bodies (not just type),
restoring TransformMany all-or-nothing; regression test with a locked layer.
WARNING:
- volume/centroid: memoize per (handle, geometry_epoch) + cap cold-cache
tessellation budget (query-batch DoS).
- entity_to_profile_curves: fail Unsupported on polyline bulge (no silent
chord-substituted sweep profile).
- Ellipse: validate minor_axis_ratio in (0,1] so bounds never under-bound.
- RasterImage bounds: bracket all four corners (rotated/flipped images).
SUGGESTION:
- binding_schema.json handles derived from spec families (includes ArcCurve/
Ellipse/Spline/Ray/XLine).
- build.rs header: enums are hand-maintained (not 'GENERATED'); ops_gen/query_gen
headers corrected to match.
- Dedupe divergence mesh_volume_centroid into the crate's geom module; host +
both mocks delegate.
Tests: +3 regression tests (scale-once, rotation, locked-layer all-or-nothing)
-> 604 host lib green; 8 crate unit tests green.
2026-09-06 08:36:06 +02:00
Sebastian
fabdeae8bf
ocs_doc_api: make mock backends exhaustive over new Curve2Spec variants
...
Add Arc/Ellipse/Spline/Ray/XLine arms to the test + example mock add_curve
kind matching and the example curve_bounds, so the crate's unit tests and
examples compile against the Phase 2 curve families.
2026-09-06 01:29:51 +02:00
Sebastian
0e18867915
IMPLEMENTATION.md: roadmap status — all 5 phases done (with noted remaining sub-items)
2026-09-06 01:23:25 +02:00
Sebastian
f24c0b2d75
ocs_doc_api: Phase 5 (media & misc, read-mostly)
...
- entity_kind_name names the media/misc families (RasterImage, Table, Leader,
MultiLeader, MLine, Mesh, Helix, Region, Body, Surface, Face3D, Dimension,
Hatch) so GetEntity reports a real kind instead of 'Other'.
- RasterImage coarse bounds (insertion + u*width + v*height).
- Generic delete already works on these families; no typed create in v1
(read-only EntityView per plan).
- spec RasterImage/Table read-mostly families; IMPLEMENTATION.md updated.
- Test phase5_media_entities_read_kind_and_bounds -> 601 host lib green.
2026-09-06 01:22:28 +02:00
Sebastian
7a481c6ce2
ocs_doc_api: Phase 4 (paper-space viewports)
...
- Operation::CreateViewport(ViewportSpec) appended to the wire enum (append-only).
- backend add_viewport (center/width/height/view_target/view_height).
- Viewport bounds (center +- w/2,h/2), transform (moves center), ensure_transformable.
- facade EntityCollection::create_viewport; spec Viewport family; api_reference +
binding_schema regenerated; mocks updated.
- Test phase4_create_viewport_bounds_transform -> 600 host lib green.
- IMPLEMENTATION.md: Phase 4 done (set_view/view-query remaining).
2026-09-06 01:16:31 +02:00
Sebastian
b03f68737e
ocs_doc_api: Phase 3 (block references)
...
- Operation::CreateInsert(InsertSpec) appended to the wire enum (append-only).
- backend add_insert validates the BlockRecord exists (unknown block -> Validation,
no mutation); host inserts acadrust::entities::Insert with scale+rotation.
- Insert transform moves insert_point (transform_entity_geometry) +
ensure_transformable includes Insert.
- facade EntityCollection::create_insert; spec Insert family; api_reference +
binding_schema regenerated; mocks updated.
- Test phase3_create_insert_and_transform -> 599 host lib green.
- IMPLEMENTATION.md: Phase 3 done (attributes/traversal remaining).
2026-09-06 01:05:51 +02:00
Sebastian
d46351cdb3
ocs_doc_api: Phase 0 + Phase 2a (sweep profiles, non-solid transform, full 2D curves)
...
Phase 0 (outstanding supported-family methods):
- add_vertex on LwPolyline (insert vertex, out-of-range validation).
- extrude / revolve from profiles (entity_to_profile_curves: Line/Circle/Arc/
LwPolyline straight-segment conversion -> geom2d::Curve -> brep::extrude/revolve).
- non-solid transform + transform_many via acadrust geometry
(transform_entity_geometry for Line/Circle/Arc/Point/LwPolyline).
- ensure_transformable broadened accordingly (all-or-nothing pre-validation).
Phase 2a (full 2D curve families): ArcCurve/Ellipse/Spline/Ray/XLine.
- Curve2Spec extended (Arc/Ellipse/Spline/Ray/XLine) + create_arc/create_ellipse/
create_spline/create_ray/create_xline facade constructors + handle types.
- entity_kind_name, entity_bounds (Arc coarse, Ellipse major-axis, Spline bbox;
Ray/XLine unbounded), transform_entity_geometry, ensure_transformable extended.
- spec/entities.toml families; api_reference.md + binding_schema.json regenerated.
Tests: +6 doc_api integration tests (phase0_*, phase2_*) -> 598 host lib green.
IMPLEMENTATION.md updated (Phase 0 done, Phase 2a done / 2b remaining).
2026-09-06 00:51:39 +02:00
Sebastian
e41086b058
Add ocs_doc_api: object-oriented CAD entity API (v2)
...
New crate crates/ocs_doc_api: object-centric facade (DocApi -> Document ->
collections -> typed handles), transport-agnostic wire layer (DocApiEnvelope =
single op | read-only query batch), per-op autocommit (no write transactions),
bulk ops with upfront-validation all-or-nothing, structured ApiError, and
build-time codegen (spec/entities.toml -> ops/query enums, api_reference.md,
binding_schema.json).
ocs_plugin_api: append-only PluginRequest::DocApiRequest / PluginResponse::
DocApiResponse (serde_bytes payload) + defaulted HostApi::doc_api_dispatch.
Host: DocApiBackend impl for HostSession (src/app/doc_api.rs) mapping to scene
primitives (solid_models lift-on-miss, register_prepared_solid_model, meshes
metrics), entity conversions (doc_api_convert.rs), HostSession accessors +
doc_api_dispatch override.
Tests: 592 host lib (incl. 7 DocApi integration tests: create/boolean/query,
unknown-id, transform-many all-or-nothing, query-batch cap, 2D/geometric/DWG
roundtrips), 8 crate unit tests. Examples + README/ARCHITECTURE/IMPLEMENTATION docs.
2026-09-06 00:15:27 +02:00