Layer split stage 1: the B-rep record, native body file and Vec/Plane come from solidcore-record (#11496)

* Kernel: the B-rep record and the native body file come from solidcore-record

SolidCraft's portable B-rep record (`solidcraft_geom::brep`: brep.rs, topology, history,
envelope, part, curve2) and the native body file (`solidcraft_kernel::native`: the tagged binary
codec and the container) move to solidcore's `solidcore-record` crate: geometry as data, with
structural validation and no maths (solidcore's docs/layers.md, stage 1). Every caller uses
`solidcore_record::brep` and `solidcore_record::native`; the old copies are deleted.

What computes from coordinates stays with the kernel, in geom's `brep`:
- `brep::check`: the record's geometric checks (orthonormal frames, non-degenerate planes,
  unit revolution axes, non-singular placements). `check::validate` and
  `check::validate_built` are the record's validation and these together, and every caller of
  `Brep::validate` uses them, so what is accepted is unchanged;
- `brep::label`: a surface's natural ranges (a cone's apex), `curve_interval`,
  `edge_curve_interval` and `form_turns`;
- `brep::pcurve::eval`: a pcurve's point;
- `geometry::check`, `placement::moved` and `split_edges` become functions on the record.

The kernel's native module keeps the conversion between a body and its saved record
(metadata.rs) and checks the decoded record's geometry. `native/analytic.rs`, which no module
declared, is deleted.

solidcore-record is pinned to its rev on solidcore's `layer-record` branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvoxKMbMFSQU8tzRtoJhtT

* Geometry: Vec2, Vec3, Plane and the profile types come from solidcore-record

The plain data of vectors and points, sketch planes and planar profiles (`Seg2`, `Loop2`,
`Region2`) moves to `solidcore-record`, with its constants and component-wise operators only
(owner decision, solidcore layer split). Their geometry stays in geom as traits:
`Vec2Geom`, `Vec3Geom`, `PlaneGeom`, `Seg2Geom`, `Loop2Geom`, `Region2Geom`, `Seg2ArcFit`,
`Loop2ArcFit` and `Region2ArcFit`, in scope with `use solidcraft_geom::prelude::*`. Every caller
names the types from `solidcore_record`; geom no longer defines or re-exports them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvoxKMbMFSQU8tzRtoJhtT

* Kernel: pin solidcore-record to solidcore main f5e8e9a29

solidcore-record is merged on solidcore main (tangency-labs/solidcore#2519); its crate there is
identical to the rev pinned before but for its clippy configuration. The lock is regenerated
against the merged rev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvoxKMbMFSQU8tzRtoJhtT

---------

Co-authored-by: jyviko <2501648+jyviko@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-11-03 09:04:26 -05:00
committed by GitHub
parent bd2dc3fade
commit dc38349cbf
806 changed files with 4281 additions and 6434 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ fn run(s: &mut Session, id: &str, params: Value) -> Value {
#[test]
fn select_geometry_resolves_points_and_indices_without_changing_history() {
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
let mut s = Session::default();
run(&mut s, "solid.box", json!({"body_name":"Block", "corner":[20,30,40], "length":10, "width":10, "height":10}));
@@ -47,7 +47,7 @@ fn select_geometry_curved_picks_round_trip_and_add_without_duplicates() {
let index = serde_json::to_value(&s.selection[0]).unwrap()["index"].clone();
run(&mut s, "select.set", json!({"items":[{"type":kind,"body":"Round","index":index}]}));
let complete = serde_json::to_value(&s.selection[0]).unwrap();
let pick: solidcraft_geom::Vec3 = serde_json::from_value(complete["point"].clone()).unwrap();
let pick: solidcore_record::Vec3 = serde_json::from_value(complete["point"].clone()).unwrap();
assert!((pick.x.hypot(pick.y) - 5.0).abs() < 1e-6, "the inferred point lies on the cylinder: {complete}");
let mut partial = complete.clone();
partial.as_object_mut().unwrap().remove("index");
@@ -73,7 +73,7 @@ fn select_geometry_uses_the_placed_body_in_world_coordinates() {
assert_eq!(complete["body"], name);
run(&mut s, "select.set", json!({"items":[{"type":kind,"body":name,"index":complete["index"]}]}));
let inferred = serde_json::to_value(&s.selection[0]).unwrap();
let pick: solidcraft_geom::Vec3 = serde_json::from_value(inferred["point"].clone()).unwrap();
let pick: solidcore_record::Vec3 = serde_json::from_value(inferred["point"].clone()).unwrap();
assert!((pick.z - 4.0).abs() < 1e-9 && (7.0..=10.0).contains(&pick.x) && (20.0..=22.0).contains(&pick.y), "{inferred}");
assert!(s.execute("select.set", &json!({"items":[{"type":kind,"body":name,"point":[1,1,4]}]})).is_err());
assert_eq!(serde_json::to_value(&s.selection[0]).unwrap(), inferred);
@@ -1515,7 +1515,7 @@ fn select_same_look_uses_resolved_looks_without_document_history_edits_and_refus
let history = (s.undo.len(), s.redo.len(), s.evaluations);
run(&mut s, "select.same_look", json!({"body":"A"}));
assert_eq!(s.selection.len(), 3);
let point = solidcraft_geom::Vec3::new(40.0, 5.0, 5.0);
let point = solidcore_record::Vec3::new(40.0, 5.0, 5.0);
let face = solidcraft_doc::appearance::face_index_at(s.world_state().unwrap().body("C").unwrap(), point).unwrap();
run(&mut s, "select.set", json!({"items":[Sel::Face {body:"C".into(),index:face,point}]}));
run(&mut s, "select.same_look", json!({}));