Skip to content

careyi3/rustcam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RustCAM

Welcome! This is the RustCAM library and app. This app and library are intended to be a set of tools for programmatically generating G-CODE for CNC machines using algorithms written in Rust. Niche, I know... Enjoy!

Contour Plots

This is a binary that gets built from this code for generating G-CODE for abstract contour plots from raster data. It is based on an original Ruby version you can find here.

Spotify Codes

Under Construction: currently does nothing.

This is a binary that gets built from this code for generating G-CODE for Spotify Code key chains generated from SVGs.

Library

This is the main library code of RustCAM. Currently it uses some hard coded defaults to generate G-CODE for a simple series of linear toolpaths.

Types

Point

A point on the X-Y plane. All points in this system are assumed to be at the same Z height.

pub struct Point {
    pub x: i32,
    pub y: i32,
}

Segment

A segment wraps the behaviour that differing kinds of movemenets within a toolpath generate different g-code.

pub trait Segment {
    fn generate_gcode(&self) -> String;
}

Line

A line defines a movement linearly between two points in the system.

pub struct Line {
    pub start: Point,
    pub end: Point,
}

Arc

An arc defines a curve moving between a start and end point of a certain radius and drawn in a certain direction (clockwise or anticlockwise).

pub struct Arc {
    pub start: Point,
    pub end: Point,
    pub radius: f32,
    pub direction: bool,
}

ToolPath

A toolpath wraps a series of connected segments together into a logical grouping in which a travel move can be performed to the starting point and then cutting moves can be performed one after another for each segment in order.

pub struct ToolPath {
    pub start: Point,
    pub end: Point,
    pub segments: Vec<Box<dyn Segment>>,
}

Methods

generate_gcode

rustcam::generate_gcode(toolpaths: Vec<ToolPath>) -> Vec<String>

write_file

file_writer::write_file(path: String, lines: Vec<String>)

About

Tools for generating G-CODE with Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors