move_xy

Function move_xy 

Source
pub fn move_xy(
    dest: Point2d,
    extrude: bool,
    feed_rate: Option<u32>,
    flow_rate: Option<f32>,
) -> String
Expand description

Returns a G1 or G0 command as a String

ยงExamples

extern crate gen_gcode;
use gen_gcode::{Point2d, move_xy};
 
let p = Point2d { x: 10.0, y: 5.0 };
// move without extruding
let gcode = move_xy(p, false, None, None);
assert_eq!("G0 X10 Y5", gcode);
extern crate gen_gcode;
use gen_gcode::{Point2d, move_xy};
 
let p = Point2d { x: 10.0, y: 5.0 };
// move with extrude
let gcode = move_xy(p, true, None, None);
assert_eq!("G1 X10 Y5", gcode);
Examples found in repository?
examples/2wallbox.rs (line 108)
104fn layer_change(cur_layer_end: Point3d, new_layer_start: Point3d, layer_hight: f32) -> Vec<String> {
105    let mut layer_change_gcode: Vec<String> = Vec::new();
106
107    layer_change_gcode.push(move_z(cur_layer_end.z + layer_hight * 1.25));
108    layer_change_gcode.push(move_xy(Point2d { x: new_layer_start.x, y: new_layer_start.y }, false, None, None));
109    layer_change_gcode.push(move_z(new_layer_start.z));
110
111    return layer_change_gcode
112}