Skip to main content

Module edit

Module edit 

Source
Expand description

Step editing: merge, split, insert, reorder, nest, move a part between steps, update a step’s fields, and each step’s presentation.

Merge, split, reorder and a part’s move stay among siblings (the steps under one parent): a group builds one thing. nest_step moves a step to another parent, children and all. Each refusal says why.

Structs§

AddReport
What add_parts did: how many occurrences joined the step, and the ones left where they were, each with the step that holds it (or the sub-assembly it is inside).
LeftOccurrence
Presentation
What a step shows: occurrences placed in earlier steps (drawn ghosted), those this step adds (highlighted), and those not placed yet (hidden).

Functions§

add_field
Add a field to step_id at index among its fields (the end when absent or past it). field is its JSON ({label, kind, …}, see StepField::from_json); an id it carries is ignored. Returns the new field’s id.
add_parts
Add components (parts of the assembly, by occurrence) to step_id: a BOM row dragged into a step. An occurrence already in a step, or inside a sub-assembly another step places whole, is left where it is and reported, unless the target step is inside that sub-assembly’s group (a descendant of the step placing it, not that step itself: the step placing the whole never also adds one of its parts). A fastener brings its torque when the step has none. Rows coalesce as everywhere (Step::coalesce_adds).
delete_step
Delete a step. Its parts must have moved elsewhere first, so no part is silently dropped from the instructions, and its child steps too.
empty_steps
Steps with nothing to do: no part to add, no steps under them (a group with parts only in its children is not empty) and no field to record (an inspection step adds no part and is still work).
insert_step
A new empty step right after after among its siblings, or at the end of the top level. Parts come to it by move_add. Returns its id.
merge
Merge step_ids (two or more siblings) into the first of them in their order, which keeps its place: adds, tools, callouts, arrows and child steps and fields are appended in order, notes joined, and the first torque and view kept.
move_add
Move one add (by index) from from to to, a sibling step. The source step may be left empty; it is then listed by empty_steps.
move_field
Move one field to index among its step’s fields (clamped to the end).
move_step
Move step_id to index among its siblings (clamped to the end).
nest_step
Move step_id, children and all, under parent (None: the top level) at index among its new siblings (clamped to the end). Its id, and its children’s, never change. A step cannot go inside itself.
presentation
The presentation of step_id over occurrences, the occurrence paths of the drawn solids (a sub-assembly occurrence stands for every path under it). The step adds what it and its descendants add (a parent installs the group its children built); placed is what its earlier siblings, and their descendants, added; a step inside a group sees nothing of the assembly around the group. Everything else is hidden.
remove_add
Take one add (by index) out of step_id: the part is in no step any more (“not yet planned”, unplanned); its insertion arrows and the callouts pointing at its occurrences go with it. Returns the add.
remove_field
Take one field off its step. Returns it.
split
Split the adds at add_indices out of step_id into a new step right after it, with the arrows and callouts that point at their occurrences. Returns the new step’s id.
unplanned
The parts of level not yet in any step, top-most first: a component no step adds, itself or through an ancestor; and, inside a sub-assembly built step by step (the step placing it has child steps), a part no step adds itself (its own step lost it). A sub-assembly’s parts are not listed while the sub-assembly itself is unplanned (they come with it) nor while a step places it whole with no child steps (the whole covers them).
update_field
Set keys of one field from a JSON patch (StepField::patched).
update_step
Update a step’s authored fields from a JSON patch. Keys: title, notes, view (string or null), tools (array), torque (object or null; a set torque becomes an override), callouts, arrows, signoff, motion, fields (the whole list; one without an id takes a fresh one). Unknown keys are refused. adds change only through the edits above.