Skip to main content

Module bom_references

Module bom_references 

Source
Expand description

A BOM from the CAD references the server found.

The scan of the CAD files (cadrefs, matched by references::files_of_revision) knows which part files an assembly uses. This module turns that into a plan (what the BOM of the revision would be, with quantities) and applies the lines the user ticked.

§Which references count

  • Files of an assembly format (SOLIDWORKS .SLDASM, Inventor, …) and NX files that have component instances (an NX .prt is a part or an assembly by its content, not by its extension), and STEP assemblies whose occurrences lead to external files. Drawings and every other file do not count: a drawing’s link to its model is a drawing of reference.
  • Quantity: NX – the placed instances of the component (hidden layers left out, as in the preview); SOLIDWORKS – the instances of the component tree without swExcludeFromBOM (a component with only excluded instances is left out); STEP – the assembly occurrences of the external file; Inventor – the occurrences in the file descriptor table (suppressed ones left out; a part with only suppressed ones is left out); otherwise 1, flagged assumed.
  • A child is listed once per item. Unmatched names are listed as not in TeamCraft (never created). Children in project groups the actor may not see are only counted.

§Invariants of apply

  • Permission: the revision is visible (“not found” otherwise); it is checked out by the actor and editable (revisions::ensure_editable, 409 otherwise).
  • Lines: only children of the plan can be chosen; an existing line is never duplicated or replaced, its quantity is changed only when update_quantities is set; a child that would make the BOM circular is refused per line.
  • Locks: the parent revision row.
  • Audit: bom.add per line (as bom::add_tx), bom.update per changed quantity and one bom.from_references with the counts.
  • Atomic: one transaction.

Structs§

ApplyRequest
ApplyResult
Plan
PlannedChild
A child found in the CAD references.
Refused
Unmatched
A referenced file TeamCraft does not have (or not visible to the actor).

Enums§

ChildStatus
QuantitySource

Constants§

ASSUMED_NOTE
Note of a line whose quantity the CAD file does not tell.

Functions§

apply
Adds the chosen children of the plan as BOM lines (see the module docs).
new_children
Number of matched, not yet used structure children (for the hint on the revision page): children found in the CAD references with the status new.
plan
What the BOM of the revision would be, from the CAD references.