Why: every reference a user makes to a face or edge (fillet and chamfer edges, sketches on faces, shell/draft/offset faces, joints, appearances) is stored as a name and found again after any upstream edit. Those names were re-derived by sampling points of each face and voting, and pieces of a split face were numbered by where their centres lay. After an upstream edit that splits, merges, mirrors or shrinks a face, a fillet or sketch could silently re-attach to the wrong face, and nothing told the user. The kernel now reports exact history for its operations, so names follow it and fail loudly instead of guessing. - crates/doc/src/lineage.rs: a feature's kernel histories composed into one lineage over nameable operands (bodies before the feature, moved copies, shell cavities, tools named by role: sketch curve, cap, box side, imported face). Instrumented: extrude/revolve/sweep/loft tools, join/cut/intersect, lumps after a cut, fillet/chamfer, shell, draft, split face/body, pattern/mirror (bodies and features), combine, boundary fill, move/scale, offset/delete face, thread, import. - crates/doc/src/history_names.rs: names from lineage; split pieces told apart by the faces only they touch (F2:top#[F2:side:l4,F4:side:l4]), merged faces answer to every name (aliases), lump bodies ordered by their faces' names instead of shell order. - crates/doc/src/name_lookup.rs, piece_names.rs: references resolve by exact name, alias or bounding faces, else nearest piece with a warning; names worked out from geometry (operations without history) are reported when only geometry decided. - Format 14: names stored by older formats get a legacy mark and are found as the build that saved them found them (some geometric names name a face history names differently: a tube's outer wall was named after its inner circle). New corpus file saved by 9a979cf. - kernel: Body::lumps carries each piece's history over the whole. - Adversarial tests: split, merge, mirrored twins, shrink to a sliver, moving cut with body pieces, history-less bodies, certified sketch. - docs/book/src/dev/naming.md describes the real mechanism and why. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J53sR6gEaVt56soFDpTck8
76 lines
2.5 KiB
Rust
76 lines
2.5 KiB
Rust
//! The SolveCraft document: user and model parameters, and a parametric timeline of features
|
|
//! (sketches, extrudes, revolves, fillets, primitives, combines…). Evaluating the timeline with
|
|
//! the kernel produces the model (bodies and solved sketches). Evaluation is incremental: a
|
|
//! feature is recomputed only when it, a parameter it uses, or an earlier feature changed.
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
pub mod appearance;
|
|
mod assembly;
|
|
mod body_transfer;
|
|
mod body_transfer_sheet;
|
|
pub use body_transfer::{valid_transfer_matrix, validate_body_transfer};
|
|
pub mod canvas;
|
|
mod clipboard;
|
|
pub use clipboard::{clone_expression, remap_topology};
|
|
pub mod config;
|
|
pub mod construct;
|
|
mod document;
|
|
mod eval;
|
|
pub mod expr;
|
|
pub mod face_anchor;
|
|
pub use face_anchor::{FaceAnchor, FaceAttachmentStatus};
|
|
pub mod format;
|
|
mod format_offsets;
|
|
mod history_names;
|
|
pub use format_offsets::whole_profile_selection_from_value;
|
|
pub mod joints;
|
|
mod lineage;
|
|
pub mod motion;
|
|
mod name_lookup;
|
|
pub mod naming;
|
|
mod params;
|
|
mod piece_names;
|
|
mod profile_refs;
|
|
pub use profile_refs::{capture_profile_selection, profile_selection_indices};
|
|
pub mod plastic;
|
|
pub mod project;
|
|
mod project3d;
|
|
pub use project3d::iso_grid;
|
|
pub mod sheet;
|
|
|
|
pub use assembly::{IDENTITY, Mat, Occurrence, apply_point, apply_vector, is_identity, map_point_expr, mat_inverse, mat_mul, rigid};
|
|
pub use document::*;
|
|
pub use eval::{
|
|
EdgeRef, FeatureResult, Model, ModelBody, ModelState, RevolveExtent, SolvedSketch, ThreadInfo, curve_pick_error, edge_names_for, edge_refs,
|
|
object_height, parse_metric_thread, pattern_matrices, revolve_extent, revolve_extent_with_convention, select_profiles, state_in_frame,
|
|
state_in_frame_at, through_all_distance, world_state,
|
|
};
|
|
pub use params::{ParamRow, ParamUser, cycles};
|
|
pub use solvecraft_kernel as kernel;
|
|
pub use solvecraft_sketch as sketch;
|
|
|
|
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
|
|
pub enum DocError {
|
|
#[error("expression: {0}")]
|
|
Expr(String),
|
|
#[error("{0}")]
|
|
Invalid(String),
|
|
#[error("unknown {0}")]
|
|
Unknown(String),
|
|
#[error(transparent)]
|
|
Sketch(#[from] solvecraft_sketch::SketchError),
|
|
#[error(transparent)]
|
|
Kernel(#[from] solvecraft_kernel::KernelError),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, DocError>;
|
|
|
|
#[cfg(test)]
|
|
mod named_projection_tests;
|
|
#[cfg(test)]
|
|
mod tests;
|
|
|
|
mod anchor_frame;
|
|
pub use anchor_frame::state_in_face_anchor_frame;
|