Skip to main content

Module assemblies

Module assemblies 

Source
Expand description

3D previews of NX, SOLIDWORKS, Inventor and Creo assemblies and CATIA products.

An assembly’s preview is put together from the previews of its component files, with the placements the assembly stores: NX in its structure stream (nxasm), SOLIDWORKS in its component tree (swpart::placements, sub-assemblies already resolved there), Inventor in UFRxDoc and AmRxSegment (invplace, sub-assemblies are files of their own; a parent may re-pose children of a flexible sub-assembly, invplace::Override), CATIA in the object stream of the product (catprod, sub-products are files of their own), Creo in the assembly’s NeuAsmSld section (mesh::creo::asm, sub-assemblies are files of their own).

  1. The components are found by file name (NAME.prt for NX, the file name of the stored path for SOLIDWORKS and Inventor, name.prt or name.asm for Creo, whose files are stored without their iteration suffix), the way file references are matched (references::files_of_revision): a file of the assembly’s own revision first, otherwise the latest revision of another item the viewer may see. A CATIA product names no files: a component is the document whose CATProdCont UUID it refers to (among the CATIA files of the product’s revision and those found by name), otherwise <part number>.CATPart or .CATProduct by name. Components that are not in TeamCraft are left out.
  2. A component that is an assembly itself is resolved the same way, its placements composed with the parent’s (depth and cycles bounded).
  3. Every part is converted like any other part (isolated preview process, cache per content; as many at a time as the preview queue runs), then every instance is placed straight into the assembly mesh. The composition runs through Previews::render: once, however many viewers and thumbnails ask for the assembly at the same time.

The result depends on which component versions were found, so it is cached under a key built from the content hashes of everything used (Previews::assembly_path): a new version of a component gives a new preview, an unchanged assembly is built once.

§Invariants

  • Permission: only files the viewer may see are used (the same project-group filter as file references); nothing is written to the database.
  • Bounds: at most MAX_DEPTH levels, MAX_PLACED placed parts and mesh::MAX_TRIANGLES triangles; an assembly that contains itself is not entered again.

Structs§

Plan
The parts of an assembly with their placements in the assembly.

Constants§

MAX_DEPTH
Nesting levels of sub-assemblies followed at most.
MAX_PLACED
Placed parts at most.

Functions§

mesh
The composed preview mesh of an assembly (cached), or None when the file is no assembly or none of its parts is in TeamCraft.
plan
The parts of the assembly sha256 (a file of revision_id in the format format), or None when it is no assembly.