Expand description
References inside CAD files: an assembly names its component files, a drawing the model it documents, a STEP file its external parts, a KiCad project its sheets.
The names are found without the CAD programs’ own libraries: TeamCraft
scans the file for text – ASCII/UTF-8 and UTF-16 (Windows programs such
as SolidWorks, Inventor, Solid Edge and CATIA store paths that way) – that
ends with the extension of a CAD file (Bracket.SLDPRT,
C:\Rover\Motor mount.ipt, 'nozzle.stp', "power.kicad_sch"). Paths
are reduced to the file name. UTF-16 strings with a length prefix (as
Inventor stores its references) are also read by their length, so a
binary field right after the name cannot hide it. The result is a list of referenced file
names; services::references matches them against the files in the
vault.
Two containers are read by their structure instead: NX parts
(nxpart: only the reference streams) and SOLIDWORKS 2015+ files
(swpart: the component tree of an assembly, otherwise the document
manager’s section – both inflated from their compressed sections). The
rest of such a file (history, old names) is never scanned.
For those two – and for STEP assemblies with external references – the
scan also tells how often an assembly places each component
(instance_counts, stored as file_references.instances); every
other format gives names only.
For every other file this is a heuristic: a name that a CAD program keeps in its file after the component was removed is still found, and compressed sections of unknown containers are not read. The revision page therefore shows the names as “found in the file”.
Structs§
- FileRef
- A file name referenced by a CAD file, with how often the file places it
where its format tells (see
instance_counts).
Constants§
- EXPORT_
NAME_ SCAN - Bytes of a STEP file read for its export name: the HEADER comes first.
- MAX_
SCAN - Bytes scanned per file.
Functions§
- find
- The CAD file names referenced in
content, withoutown_name; each name once (case-insensitive), in the order found. - instance_
counts - How often an assembly places each component file – keyed by the lower case, normalised file name – where its format tells:
- scan_
export_ name step_export_nameof a stored file (its firstEXPORT_NAME_SCANbytes);Noneif it cannot be read.- scan_
file - Reads a stored file and finds its references: NX parts through their
stream directory and SOLIDWORKS 2015+ files through their sections (with
seeks, so large files are read completely), everything else from its
first
MAX_SCANbytes. The instance counts come frominstance_countsfor the file’sformat. - scans
- Whether files of this format are scanned for references: assemblies, drawings, multi-purpose models (NX, Fusion, FreeCAD, …), STEP/JT (external references), PLM XML and KiCad projects/schematics.
- step_
export_ name - The name a STEP file was exported under – the first string of the
FILE_NAME(...)entity in its HEADER, reduced to the file name – when it is the name of a referencable file and differs fromown_name. Other files may reference the file under that name (an assembly exported together with its parts, a part renamed after the export); it is a second name of the file itself and never a reference to another file. - with_
counts - The names with their counts: a name the counts do not list is
None(not known), as is every name when the file tells no counts.