Skip to main content

Module replace_component

Module replace_component 

Source
Expand description

REPLACE COMPONENT, the app side: what a replacement can be (a stored part, or a part the assembly already carries), which occurrences a “Replace all instances” covers, and the one door the menu, the summary and the automation command share. The engine does the swap and the mate classification (brep_render::engine_state::replace_component).

Structs§

Candidate
One offered replacement.
Preview
What replacing component_id with candidate will do, BEFORE it is done.
ReplaceDialog
The Replace component window. open it on an occurrence; it shows the chooser, runs the replace, then the summary of what happened to the mates until the user closes it. Reopened with no target (Self::review) it is the summary alone, for mates still held from an earlier replace.

Enums§

ReplaceSource
What the occurrence is replaced WITH.

Constants§

GROUPS
Section titles, in the order the chooser shows them.

Statics§

HIT_KEYS
The hit keys this window publishes (see automation::hit_keys).

Functions§

accept_suggestions
Accept every PRE-TICKED suggestion of the given held mates (every held mate, at every depth, when ids is empty) as one undo step.
candidate_matches
Whether candidate matches what the user typed: its label, its store name, and in a PLM session the part number and name the index holds for it. Case-insensitive; an empty filter matches everything.
candidates
The candidates for replacing component_id, best first: other members of its family (when it is one; by row name), the other parts this assembly already carries, the part files beside it (its folder, or the PLM workspace a PLM store lists), recent files. browse adds every part file the store lists. The occurrence’s own part is never offered, and neither is exclude (the assembly being edited: it cannot contain itself).
delete_held
Delete a held mate at any depth (one undo step).
finish_work_part_for_replace
A replace edits the assembly, and a Work part edited in context couples its part’s undo to the assembly’s: a part undo after the replace would undo the REPLACE, and a push meant for the old part would land on whatever the occurrence shows now. So when the active assembly hosts a Work part session, the replace first finishes it (Return to assembly: its edits are kept) and says so. Returns that line, or None when no session was open.
held_mates
Every mate a replace is holding, at every depth, as the top window lists them. A top-level mate is the engine’s row. A mate inside a sub-assembly is listed per occurrence path of that sub-assembly: its id is <occurrence path>:<constraint id> (ACOMP1:CONC1) and its refs are namespaced the same way (ACOMP1:ACOMP1:Hole_S), with its suggestion chosen and ticked from the new part’s geometry exactly as at the top.
held_summary
What the Constraints pane says about held mates, (count, wording), kept in cache per history revision. held_mates clones the whole parts library and walks every nested definition (~5 ms a frame on l500); the count and the wording read only the document, never the suggestions that follow the scene, and every document write moves the revision (undo and redo included).
instances_of
Every ACOMP occurrence that shows the same part as component_id (itself included), in history order — the “Replace all instances of <part>” set.
pattern_line
What a Pattern Component makes of replacing seed: opened on one of its instances (instance: the instance id, its pattern and number), why the chooser shows the seed; else how many instances follow it. None when no pattern is seeded by it.
preview
The preview for candidate (lineage against the occurrence’s current part, the mates it touches, the candidate’s document). None for an unknown component.
repair
Repair held references at any depth, as ONE undo step: (mate id, old ref, new ref) with the ids and refs held_mates lists. A nested mate’s new ref must lie inside the same sub-assembly. A mate with nothing left held is re-enabled (if it was enabled before) and loses its marker.
replace
Replace the part shown by component_ids with source. One undo step; the mates’ report lands with the run (EngineState::replace_report). Returns the new parts-library entry name.
replace_nested
Replace a part placed INSIDE a sub-assembly, from the top assembly. path is the occurrence path (ACOMP3:ACOMP1: the top occurrence, then the placement inside its definition, at any depth). The sub-assembly’s definition is edited, so every placement of that sub-assembly follows, and a Save writes it into the sub-assembly’s own file. With all_instances, every placement of the same part in that sub-assembly is replaced. Mates inside the sub-assembly are held (disabled, marked) when the parts share no lineage, exactly as at the top; the top assembly’s mates on the replaced part go through the usual classification. One undo step.
search_candidates
The chooser’s list for what was typed: the usual sections when nothing is, and EVERY part the store lists (other folders, the whole PLM index) narrowed to the matches once something is, with no Browse click.