pub struct Context<'a> { /* private fields */ }Expand description
A program tool context that updates the state data for operations paired with a specific tool. The reason for grouping the operations per tool is to reduce the amound of tool changes, which is expecially useful for CNC machines that needs manual tool changes.
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
Sourcepub fn merge(&mut self, context: Context<'_>) -> Result<()>
pub fn merge(&mut self, context: Context<'_>) -> Result<()>
Applies operations from one context to this context.
Returns error if tool or units are not the same in both contexts.
Sourcepub fn append_cut(&mut self, cut: Cut)
pub fn append_cut(&mut self, cut: Cut)
Appends a cut operation to the context.
Sourcepub fn z_safe(&self) -> f64
pub fn z_safe(&self) -> f64
Returns the z safe value set for this context.
The value indicates the z height where the machine tool can safely travel in the x and y axis without colliding with the workpiece.
Sourcepub fn z_tool_change(&self) -> f64
pub fn z_tool_change(&self) -> f64
Returns the z height position used for manual tool change.
Sourcepub fn operations(&self) -> Vec<Operation>
pub fn operations(&self) -> Vec<Operation>
Returns all operations for this context.
Sourcepub fn to_instructions(&self) -> Result<Vec<Instruction>>
pub fn to_instructions(&self) -> Result<Vec<Instruction>>
Converts context to G-code instructions.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Context<'a>
impl<'a> !RefUnwindSafe for Context<'a>
impl<'a> !Send for Context<'a>
impl<'a> !Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> !UnwindSafe for Context<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more