Expand description
A template’s input marks and its spin-out (.tbrep).
A template (.tbrep): a seed whose MARKED expressions are the user’s
inputs. Inserting one never places the template: it asks for a new name
and the input values, spins out a unique normal part with those values
baked into its expressions, and places that.
The marks live in the template document as the top-level templateInputs
block — one entry per input expression, with an optional label, limits or
fixed list of choices. The spun-out copy KEEPS its expressions (it is an
ordinary part the user can keep tweaking) and records where it came from in
templateSource: the template’s file name and a content hash, for
traceability only. Nothing links back; changing the template never touches
a copy.
Structs§
- Template
Input - One marked input: an expression the user sets when inserting.
- Template
Source - What a spun-out copy records about its template.
Constants§
- TEMPLATE_
INPUTS_ KEY - The document key the input marks are stored under.
- TEMPLATE_
SOURCE_ KEY - The document key a spun-out copy records its template under.
Functions§
- apply_
inputs - Replace the engine document’s input marks as a USER edit (one undo step;
coalescegroups a typing run). An empty list removes the block. - assignments
- The
name = rhsassignments of an expressions source, in order. - default_
value - The template’s own value for
name(its defining expression’s source), what the insert prompt starts the field from. - engine_
inputs - The inputs the engine’s document marks. One map lookup and a small parse.
- inputs_
of - The inputs a template document marks (empty when none, or unreadable).
- name_
problem - Why
namecannot be the spun-out part’s name, if it cannot: the same file name rules as a family member’s part number. - spin_
out - The specialised copy of
template(filetemplate_file) withvalues(input name -> source text) baked into its expressions: a normal part that keeps its expressions, drops the input marks and the class, and records its template. Every value is checked first; the first problem is the error. - template_
hash - A content hash of the whole template document less the view state it reopens in.
- template_
source - The copy’s record of its template, if the document is a spun-out copy.
- value_
problem - Why
textis not an acceptable value forinput, if it is not: it must evaluate (against the template’s own expressions, sowidth * 2works) to a finite number inside the limits, and be one of the choices when there are choices.