Repository navigation
Conversation
Fit to area (`fit_to_area`, `--fit-to-area W,H`): - Uniformly scales the drawing so its plotted strokes fit within W x H mm, preserving aspect ratio, and places its corner at `origin`. - Either axis may be left empty to leave it unconstrained. - Measures strokes only, since fills and images are not plotted. - `fit_shrink_only` / `--fit-shrink-only true` never enlarges drawings. Bed-size check (`machine.bed_size`, `--bed-size W,H`): - After conversion, checks every stroke against a bed from (0,0) to W x H mm. - `bed_check` is `error` by default (no g-code is written, exit code 1); `warn` / `--bed-check warn` writes g-code and prints a warning. - Error messages report how far the drawing overshoots each edge. - New `svg_to_gcode_with_bounds` and `check_bed_bounds` in the library; `svg_to_gcode` is unchanged. Web UI: new settings fields for fit area, shrink-only, bed size and warn-only; out-of-bed drawings show an alert and are skipped unless warn-only is enabled. Settings without the new fields load unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Adds two options for getting drawings onto a plotter safely: scaling a drawing to fit a given area, and checking that it fits on the machine's bed. Both are available in the CLI, the web settings and JSON settings files. Both are off by default, so existing conversions are unchanged, and settings files without the new fields load as before.
Fit to area
ConversionConfig::fit_to_area: [Option<f64>; 2], CLI--fit-to-area W,Horigin. An empty origin axis is treated as 0.200,or,150) to leave it unconstrained.PreprocessTurtlenow tracks a strokes-only bounding box for this, and falls back to the full bounding box when there are no strokes. The existing origin and clip path behavior is unchanged.fit_shrink_only(--fit-shrink-only true) only shrinks drawings that are too large, and never enlarges small ones.Bed-size check
MachineConfig::bed_size: [Option<f64>; 2]andMachineConfig::bed_check: BedCheck, CLI--bed-size W,Hand--bed-check error|warnerror(the default), no g-code is written and the CLI exits with code 1. The error says how far the drawing goes past each edge:warn, the g-code is written and the message is logged as a warning.GCodeTurtlerecords the bounds of what it draws. Newsvg_to_gcode_with_boundsandcheck_bed_boundsfunctions are exported, andsvg_to_gcodeis unchanged.Testing
cargo test --workspacepasses, nightlycargo fmt --checkpasses, and nightly clippy passes with-D warningsfor every feature combination ofsvg2starandsvg2gcode, plus the CLI and web crates.wasm32-unknown-unknownand was tested deployed.🤖 Generated with Claude Code