Expand description
Similar part search: “do we already have a part like this?”.
Every 3D file (meshes and STEP, the formats of the 3D preview) gets a
shape signature (see shape) when its preview is generated – after an
upload, when a viewer opens it, or by teamcraft vault signatures for
older files. Signatures are stored once per blob (shape_signatures).
find ranks the latest revisions of other items by
shape::compare: a SQL prefilter on indexed columns (the largest
extents within a factor of SIZE_WINDOW, or the proportions within a
factor of RATIO_WINDOW when scale is ignored – wide enough never to
drop a part that could reach MIN_SCORE) keeps at most PREFILTER
files, which are then scored in Rust – the work stays bounded however
large the vault is. One hit per item (its best file), scores below
MIN_SCORE are dropped.
Visibility is the one of the item search: candidates are all items the actor may read (no items of restricted groups it is not a member of – their signatures are neither matched nor counted) except the source.
Structs§
- Candidate
- One similar part.
- Options
- How to search.
- Report
- The answer for a revision (web page, REST API, MCP).
- Signature
Summary - The signature in the words of a result.
- Source
File - The source of a search and what is known about its shape.
Enums§
Constants§
- MAX_
LIMIT - Most hits in one result.
- MIN_
SCORE - Candidates below this score (0…1) are not shown.
- PREFILTER
- Files scored in Rust after the SQL prefilter.
- RATIO_
WINDOW - Both proportions within this factor (ignoring scale): the two |ln ratio| of a hit sum to at most ln 2.
- SIZE_
WINDOW - Largest and middle extent within this factor (with scale). A hit needs
size ≥ MIN_SCORE, i.e. Σ|ln ratio| over three extents ≤ 1.5·ln 2, so no single extent of a hit is off by more than 2^1.5 ≈ 2.83.
Functions§
- ensure
- The signature of a blob: stored, or computed in the preview process (converting the file first if needed) and stored.
- find
- Ranks the latest revisions of all other items by their similarity to
source(see the module documentation). - for_
files for_revisionwith the revision’s files already at hand.- for_
revision - Similar parts of a revision: picks its 3D file (or
filename), gets the signature – waiting at mostwaitfor a computation, which goes on in the background – and searches. - missing
- Stored files (current versions) with a 3D format and no signature yet,
for
teamcraft vault signatures: distinct blobs afterafter(keyset paging by hash) with their format. - pick_
file - The file a revision is compared by:
filenameif given, else its STEP model, else its first mesh. - shape_
format - The preview format of a file usable for shapes (not point clouds).
- spawn_
ensure ensurein the background (after uploads); the handle may be awaited with a time limit – dropping it does not stop the work.- store
- Stores (or replaces) the signature of a blob. Derived data – no audit record, like the text index.
- stored
- The stored signature of a blob (of the current
shape::VERSION).