diff --git a/cli/src/main.rs b/cli/src/main.rs index 9ca9222..1c0b555 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -18,34 +18,34 @@ use svg2gcode::{ #[derive(Debug, StructOpt)] #[structopt(name = "svg2gcode", author, about)] struct Opt { - /// Curve interpolation tolerance + /// Curve interpolation tolerance (mm) #[structopt(long, default_value = "0.002")] tolerance: f64, - /// Machine feed rate in mm/min + /// Machine feed rate (mm/min) #[structopt(long, default_value = "300")] feedrate: f64, - /// Dots per inch (DPI) for pixels, points, picas, etc. + /// Dots per Inch (DPI) + /// Used for scaling visual units (pixels, points, picas, etc.) #[structopt(long, default_value = "96")] dpi: f64, #[structopt(alias = "tool_on_sequence", long = "on")] - /// Tool on "G-Code sequence + /// G-Code for turning on the tool tool_on_sequence: Option, #[structopt(alias = "tool_off_sequence", long = "off")] - /// Tool off "G-Code sequence + /// G-Code for turning off the tool tool_off_sequence: Option, - /// Optional "G-Code begin sequence (i.e. change to a cutter tool) + /// G-Code for initializing the machine at the beginning of the program #[structopt(alias = "begin_sequence", long = "begin")] begin_sequence: Option, - /// Optional "G-Code end sequence, prior to program end (i.e. put away a cutter tool) + /// G-Code for stopping/idling the machine at the end of the program #[structopt(alias = "end_sequence", long = "end")] end_sequence: Option, - /// A file path for an SVG, else reads from stdin + /// A file path to an SVG, else reads from stdin file: Option, /// Output file path (overwrites old files), else writes to stdout #[structopt(short, long)] out: Option, - /// Set where the bottom left corner of the SVG will be placed. Also affects begin/end and - /// on/off sequences. + /// Coordinates for the bottom left corner of the machine #[structopt(long, default_value = "0,0")] origin: String, /// Whether to use circular arcs when generating g-code diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 2e18415..42fdbf2 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,13 +1,13 @@ /// Approximate [Bézier curves](https://en.wikipedia.org/wiki/B%C3%A9zier_curve) with [Circular arcs](https://en.wikipedia.org/wiki/Circular_arc) mod arc; -/// Converts an SVG to "G-Code in an internal representation +/// Converts an SVG to G-Code in an internal representation mod converter; -/// Emulates the state of an arbitrary machine that can run "G-Code +/// Emulates the state of an arbitrary machine that can run G-Code mod machine; -/// Operations that are easier to implement after "G-Code is generated, or would +/// Operations that are easier to implement after G-Code is generated, or would /// otherwise over-complicate SVG conversion mod postprocess; -/// Provides an interface for drawing lines in "G-Code +/// Provides an interface for drawing lines in G-Code /// This concept is referred to as [Turtle graphics](https://en.wikipedia.org/wiki/Turtle_graphics). mod turtle; diff --git a/lib/src/machine.rs b/lib/src/machine.rs index 9af337f..6f8b84a 100644 --- a/lib/src/machine.rs +++ b/lib/src/machine.rs @@ -35,7 +35,7 @@ impl std::ops::Not for Distance { } /// Generic machine state simulation, assuming nothing is known about the machine when initialized. -/// This is used to reduce output "G-Code verbosity and run repetitive actions. +/// This is used to reduce output G-Code verbosity and run repetitive actions. #[derive(Debug, Default, Clone)] pub struct Machine<'input> { supported_functionality: SupportedFunctionality, diff --git a/web/src/inputs.rs b/web/src/inputs.rs index ef14e58..2d65e48 100644 --- a/web/src/inputs.rs +++ b/web/src/inputs.rs @@ -276,27 +276,27 @@ macro_rules! form_input { form_input! { Tolerance { "Tolerance", - "Curve interpolation tolerance", + "Curve interpolation tolerance (mm)", tolerance, } Feedrate { "Feedrate", - "Machine feedrate in mm/min", + "Machine feedrate (mm/min)", feedrate, } Dpi { "Dots per Inch", - "Used for non-physical units (pixels, points, picas, etc.)", + "Used for scaling visual units (pixels, points, picas, etc.)", dpi, } OriginX { "Origin X", - "X-axis coordinate for the bottom left corner of the SVG", + "X-axis coordinate for the bottom left corner of the machine", origin => 0, } OriginY { "Origin Y", - "Y-axis coordinate for the bottom left corner of the SVG", + "Y-axis coordinate for the bottom left corner of the machine", origin => 1, } } @@ -390,9 +390,10 @@ pub fn settings_form() -> Html { - + @@ -437,89 +438,6 @@ pub fn settings_form() -> Html { } } -// pub enum FileMsg { -// File(File), -// Data(FileData), -// } - -// pub struct SvgUploadOrLink { -// link: ComponentLink, -// reader_task: Option, -// } - -// impl Component for SvgUploadOrLink { -// type Message = FileMsg; - -// type Properties = (); - -// fn create(props: Self::Properties, link: ComponentLink) -> Self { -// Self { -// link, -// reader_task: None, -// } -// } - -// fn update(&mut self, msg: Self::Message) -> ShouldRender { -// match msg { -// FileMsg::File(file) => { -// self.reader_task = Some( -// ReaderService::read_file(file, self.link.callback(FileMsg::Data)).unwrap(), -// ); -// false -// } -// FileMsg::Data(data) => { -// self.reader_task = None; -// false -// } -// } -// } - -// fn change(&mut self, _props: Self::Properties) -> ShouldRender { -// todo!() -// } - -// fn view(&self) -> Html { -// html! { -// -// } -// } -// } - -// trait FileInputDispatcher: Dispatcher { -// fn file_text( -// &self, -// f: impl Fn(&mut ::Model, Result) + Copy + 'static, -// ) -> Callback -// where -// Self: Clone, -// { -// let set_file = self.future_callback_with(f); -// Callback::from(move |file_list: FileList| { -// for file in (0..file_list.length()).filter_map(|i| file_list.item(i)) { -// let cb = set_file.clone(); -// read_as_text(&gloo_file::File::from(file), move |result| { -// cb.emit(result); -// }) -// .await; -// } -// }) -// } -// } - -// impl FileInputDispatcher for T {} - #[function_component(SvgInput)] pub fn svg_input() -> Html { let app = use_store::(); diff --git a/web/src/spectre/mod.rs b/web/src/spectre/mod.rs index 85cc78f..a5c04c4 100644 --- a/web/src/spectre/mod.rs +++ b/web/src/spectre/mod.rs @@ -116,6 +116,7 @@ where #[derive(Properties, PartialEq, Clone)] pub struct CheckboxProps { pub label: &'static str, + pub desc: Option<&'static str>, #[prop_or(false)] pub checked: bool, #[prop_or_default] @@ -131,6 +132,13 @@ pub fn checkbox(props: &CheckboxProps) -> Html { { props.label } + { + if let Some(desc) = props.desc { + html! {

{ desc }

} + } else { + html!() + } + } } }