Repository navigation
Conversation
923bd92 to
0bc5830
Compare
06f7ec5 to
4d0930b
Compare
4d0930b to
a501dda
Compare
Text templates can use {serial}, formatted like any other value
({serial:04d}, SN-{serial:05d}). The counter (current, start, step,
optional end with wrap, auto-advance) is stored in the project.
Each workpiece has a variable offset: a copy with offset n shows the
value n steps after the current one, so array copies can carry
consecutive numbers. When the counter changes, only workpieces whose
templates read a document variable regenerate, keeping their scale.
Refs barebaric#527
DocEditor.variable_text changes the counter (settings, Next, Previous, Reset) through the undo history, so the document is marked modified and an accidental change can be undone. Number Copies gives selected items the offsets 0, 1, 2, ... in reading order, and grid and circular arrays give their copies increasing offsets. Refs barebaric#527
MachineCmd now knows whether a send job ran to its end: cancelling marks the running job, and the monitored run reports completion. Only then, and not for a pointer dry run, the editor advances the counter by one step per numbered copy. Framing and failed jobs never advance it. An optional setting also advances it after a G-code export, for jobs that run from a memory card. Refs barebaric#527
Tools > Variable Text opens a dialog with the counter settings, Previous / Next / Reset and a preview of the numbers the next job uses. Arrange > Array > Number Copies numbers a selection in reading order, and the workpiece properties show the variable offset of a template workpiece. Refs barebaric#527
A project can carry the rows of a CSV file (stored in the project,
with the file path for reloading). Text templates read the columns
through {csv["Name"]} or by position {csv[0]}, and {row} is the 1-based
row number. A copy shows row current + variable offset; past the last
row every column reads as empty. The delimiter is detected, and the
first row holds the column names unless it is all numbers.
Refs barebaric#528
DocEditor.variable_text loads and reloads the linked CSV file (reload keeps the current row), and moves the row with First / Previous / Next, all through the undo history. After a finished job the serial counter and the CSV row advance in one undo step, each only when a workpiece uses it. The row stops after the last row and a notification says that every row has been used. Refs barebaric#528
The dialog gets a CSV Merge section: choose or reload the linked file, the columns and row count, the current row, auto-advance, a preview of the rows the next job uses, the number of copies that cover the remaining rows, and First / Previous / Next buttons. Refs barebaric#528
a501dda to
e139e7c
Compare
|
This pull request was closed automatically because its description does not follow the pull request template. Problems found:
Please edit the pull request description to answer every section and to tick every checkbox; as soon as it complies, the pull request is reopened automatically. See CONTRIBUTING.md. |
|
I'm putting this back to draft. Your comment on #554 from 18/10 changes the base for this PR: the document carries one job counter, not arbitrary variables, and CSV belongs in an app-global data source addon together with database and REST sources. Storing CSV rows in the project goes against that. So I won't push the CSV rework I had prepared. Once #554 has landed I'll write down a few use cases and a proposal for such a data source addon first, as you suggested, and post it for review before writing code. |
What does this PR change?
Stacked on #554: it uses the job counter's variable offsets and the auto-advance hook from there. Until #554 lands, this diff also shows #554's commits; the CSV work starts at "feat: merge CSV rows into text templates".
Implements #528, Variable Text "Merge/CSV" as in LightBurn:
{csv["Name"]}, or by position,{csv[0]};{row}is the 1-based row number.current + variable offset, so a grid array lays out one row per copy. Copies past the last row show empty columns.,;tab|) is detected, and UTF-8 is read with or without BOM. The first row holds the column names unless every cell is a number.Out of scope, as agreed: editing CSV contents in Rayforge, encodings other than UTF-8, and an unattended one-job-per-row loop.
Why did you choose this specific architectural approach?
CSV rows are document data, like the job counter, so they live in the document next to it and reuse the same two mechanisms from #554:
current + n);Templates receive the row as values through the same provider-params path as
{counter}, so neither the CSV store nor the workpiece needs to know about template syntax.The rows are copied into the project instead of re-reading the file at job time, so a moved or edited CSV can't silently change a job; Reload is explicit and undoable. The header heuristic ("all numbers → no header") replaces
csv.Sniffer.has_header, which is unreliable on short files.How did you manually test this locally?
Namecolumn and 4 rows (Ann, Bob, Cas, Dirk). In the Variable Text / Job Counter dialog, load it: the dialog shows the columns and "4 rows".{row}: {csv["Name"]}, arrayed to 3 copies: they show "1: Ann", "2: Bob", "3: Cas".Checklist
this code.