Skip to main content

Module document_class

Module document_class 

Source
Expand description

The three document classes (.nbrep / .fbrep / .tbrep). The three document classes: a normal part (.nbrep), a family seed (.fbrep) and a template (.tbrep).

On the file system the EXTENSION carries the class, matched case-insensitively and written lowercase. The document carries it too, as the top-level documentClass field (absent on a normal part, so every existing file stays byte-identical). The two agree by construction: a load writes the field from the file’s extension, and Save As writes the field the dialog’s class choice names before the file gets that extension. The field is what answers for a document that has no file yet (a new family), and what the PLM, which keys documents without extensions, will read.

Enums§

DocumentClass
What a document is for.

Constants§

DOCUMENT_CLASS_KEY
The document key the class is stored under.

Functions§

document_class
The class of the document the engine holds, from its documentClass field. Cheap enough for every frame: one map lookup.
is_family
Whether the engine holds a family seed.
is_template
Whether the engine holds a template.
set_class_in_json
Set the class field on a document’s JSON (None removes it).
set_document_class
Write the class into the engine’s document without an undo step: this is bookkeeping (what the file is), not an edit the user could undo.
strip_class_extension
name without a trailing class extension (any case).