Handwriting-like stroke order, row tuning, and pen-up metrics for G-code export#1
Open
RealBuddy wants to merge 4 commits into
Open
Handwriting-like stroke order, row tuning, and pen-up metrics for G-code export#1RealBuddy wants to merge 4 commits into
RealBuddy wants to merge 4 commits into
Conversation
- Add extract_to_dict() and argparse-based extract CLI with -o/--output - Replace plot_strokes subprocess with direct extract_to_dict import - Add sdocx_gcode: px-to-mm scaling, Z pen lift profile, multi-page/M0 - Add samsung-notes entry point: extract, gcode, inbox batch - Bundle default profile samsung_notes_profiles/grbl_plotter_z.toml - Document pip install -e . and commands in README - Ignore outbox, inbox, build, and egg-info
- Replace global (ymin, xmin) sort with ymin-sweep row bands and xmin within row - Add --flip-y/--no-flip-y with default mirror for page-to-machine Y - Update README and CLI help for writing-order and flip defaults
- Replace global greedy and ruled-rows chain with one order_strokes() path (ruled rows, horizontal bands, local greedy chain, debris per band, carriage Y) - Remove --ruled-rows-order and ruled_rows_order from CLI/API - G-code page comment: "reordered" when stroke reordering is on - Update README and plot_strokes --show-rows help text
- Add pen_up_travel_xy_mm and samsung-notes metrics (sweep, optimize-row-scale) - StrokeOrderTuning dataclass; thread row_height_scale and tuning through G-code path - Sequential optimize sweeps for x-gap, chain weights, intra-line slack, carriage Y - plot_strokes: optional --row-height-scale for row overlay - Default RULED_LINE_ROW_HEIGHT_SCALE=1.1 after sample optimize - README: metrics and tuning examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch delivers a single, opinionated stroke-ordering pipeline for Samsung Notes → GRBL G-code, tools to measure and tune it, and a sensible default row scale from optimization on a sample note.
Stroke ordering
--ruled-rows-orderandorder_strokes_writing_modeare gone; public entry isorder_strokes().Tuning & quality
RULED_LINE_ROW_HEIGHT_SCALEdefault set to 1.1 after--optimize-row-scaleon the sample (min total pen-up XY travel for that file).StrokeOrderTuningdataclass (x-gap factor, chain Y/back-X weights, intra-line slack, carriage multiplier) with defaults matching old hard-coded behavior; threaded through ordering andcollect_strokes_mm_for_page/ G-code build (optionalstroke_order_tuningon the API).CLI & metrics
samsung-notes metrics: per-page tables (--sweep-row-scale), sequential--optimize-row-scale [MIN:MAX:STEP](default0.8:2.5:0.1) for total pen-up mm across pages, plus 1D sweeps for order knobs:--optimize-x-gap-factor,--optimize-chain-y-weight,--optimize-chain-back-x-weight,--optimize-intra-line-y-factor,--optimize-carriage-y-lines(each optionalMIN:MAX:STEPor built-in default when the flag is bare).pen_up_travel_xy_mm()— sum of Euclidean XY jumps between consecutive stroke starts (matches emitted G0 travel between polylines).--row-height-scaleon gcode, inbox, and plot_strokes (--show-rows) so SVG row bands match the same grid as G-code when desired.Docs
Suggested review focus
.sdocxand compare visual row bands (plot_strokes --show-rows) vs pen-up frommetricswhen changing--row-height-scale.