Skip to content

Commit

Permalink
docs: update README.md examples
Browse files Browse the repository at this point in the history
Update README.md exampels to use the newer program.context(tool) method
over the deprecated program.extend(&tool, |context| ...) closure API.
  • Loading branch information
tirithen committed Oct 31, 2023
1 parent 613fabc commit 053ce10
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,20 @@ fn main() -> Result<()> {
5000.0, // Max feed rate/speed that the cutter will travel with (mm/min)
);

// Extend the program with the planing cuts
program.extend(tool, |context| {
// Append the planing cuts to the cylindrical tool context
context.append_cut(Cut::plane(
// Start at the x 0 mm, y 0 mm, z 3 mm coordinates
Vector3::new(0.0, 0.0, 3.0),
// Plane a 100 x 100 mm area
Vector2::new(100.0, 100.0),
// Plane down to 0 mm height (from 3 mm)
0.0,
// Cut at the most 1 mm per pass
1.0,
));

Ok(())
})?;
// Get the tool context to extend the program
let mut context = program.context(tool);

// Append the planing cuts to the cylindrical tool context
context.append_cut(Cut::plane(
// Start at the x 0 mm, y 0 mm, z 3 mm coordinates
Vector3::new(0.0, 0.0, 3.0),
// Plane a 100 x 100 mm area
Vector2::new(100.0, 100.0),
// Plane down to 0 mm height (from 3 mm)
0.0,
// Cut at the most 1 mm per pass
1.0,
));

// Write the G-code (for CNC) `planing.gcode` and Camotics project file
// `planing.camotics` (for simulation) to disk using a resolution value
Expand Down

0 comments on commit 053ce10

Please sign in to comment.