Skip to content

Commit

Permalink
Merge branch 'main' of ci.goget.dev:cnc/cnccoder
Browse files Browse the repository at this point in the history
  • Loading branch information
tirithen committed Apr 27, 2024
2 parents 873d471 + c02a03e commit 6c3ce84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ fn main() -> Result<()> {
20.0, // Cutter length
10.0, // Cutter diameter
Direction::Clockwise, // Spindle rotation direction
20000.0, // Spindle speed (rpm)
5000.0, // Max feed rate/speed that the cutter will travel with (mm/min)
10000.0, // Spindle speed (rpm)
3000.0, // Max feed rate/speed that the cutter will travel with (mm/min)
);

// Get the tool context to extend the program
Expand Down
2 changes: 1 addition & 1 deletion examples/planing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() -> Result<()> {
20.0, // Cutter length
10.0, // Cutter diameter
Direction::Clockwise, // Spindle rotation direction
20000.0, // Spindle speed (rpm)
5000.0, // Spindle speed (rpm)
500.0, // Max feed rate/speed that the cutter will travel with (mm/min)
);

Expand Down
7 changes: 7 additions & 0 deletions src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use std::cell::RefCell;
use std::collections::hash_map::Entry::Vacant;
use std::collections::HashMap;
use std::rc::Rc;
use std::time::Duration;

use anyhow::{anyhow, Result};
use time::OffsetDateTime;
Expand All @@ -57,6 +58,7 @@ use crate::cuts::*;
use crate::instructions::*;
use crate::tools::*;
use crate::types::*;
use crate::utils::scale;

/// A high level respresentation of a CNC program operation, Cut, Comment, Message, or Empty.
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -726,6 +728,11 @@ impl Program {
} else {
Instruction::M4(M4 {})
},
Instruction::G4(G4 {
p: Duration::from_secs(
scale(tool.spindle_speed(), 0.0, 50_000.0, 3.0, 20.0) as u64,
),
}),
]);

// Add tool instructions
Expand Down

0 comments on commit 6c3ce84

Please sign in to comment.