Struct Context

Source
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>

Source

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.

Source

pub fn append(&mut self, operation: Operation)

Appends an operation to the context.

Source

pub fn append_cut(&mut self, cut: Cut)

Appends a cut operation to the context.

Source

pub fn units(&self) -> Units

Returns the units used by the context.

Source

pub fn tool(&self) -> Tool

Returns the tool used by the context.

Source

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.

Source

pub fn z_tool_change(&self) -> f64

Returns the z height position used for manual tool change.

Source

pub fn bounds(&self) -> Bounds

Returns the bounds for this context.

Source

pub fn operations(&self) -> Vec<Operation>

Returns all operations for this context.

Source

pub fn to_instructions(&self) -> Result<Vec<Instruction>>

Converts context to G-code instructions.

Trait Implementations§

Source§

impl<'a> Clone for Context<'a>

Source§

fn clone(&self) -> Context<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Context<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.