Skip to main content

GcodeIndex

Struct GcodeIndex 

Source
pub struct GcodeIndex { /* private fields */ }
Expand description

One file’s slicer plan, by file position.

Implementations§

Source§

impl GcodeIndex

Source

pub const fn bytes(&self) -> u64

How many bytes the index was built from.

Source

pub const fn lines(&self) -> u64

How many lines the index was built from.

Source

pub const fn layer_count(&self) -> usize

How many layers the file plans.

Source

pub const fn entries(&self) -> usize

How many entries the index holds: layers, time marks, flow and fan settings, and objects.

Source

pub fn resident_bytes(&self) -> usize

How many bytes the index itself holds on the heap and inline, which is what keeping it in memory for a print costs.

Source

pub fn planned_changes(&self) -> Vec<PlannedChange>

Every change the file plans, in file order: none for a file that plans none.

Source

pub fn planned_change(&self, index: u32) -> Option<&PlannedChange>

One planned change, by its index.

Source

pub fn planned_segments(&self) -> Vec<PlannedSegment>

The stretches of the file between its planned changes, each with its colour and the filament it feeds: none for a file that plans no change.

Source

pub fn change_waiting_at( &self, file_position_bytes: u64, ) -> Option<&PlannedChange>

The planned change a job standing at a file position is waiting at: the last one whose line it has reached, when it is no further than PLANNED_CHANGE_REACH_BYTES past it.

Source

pub fn expected_color_at(&self, position: i64) -> Option<String>

The colour the print should be laying at a file position: the colour of the stretch the position is in, a planned change counting from the moment its line is read. Nothing for a file that plans no change, or a stretch whose colour the file does not name.

Source

pub fn object_outlines(&self) -> &[ObjectOutline]

Each object’s footprint outline, in SlicerPlan::objects’ order; one outline over all the part’s extrusion when the file labels no objects, and none when it lays nothing.

Source

pub fn object_at(&self, file_position_bytes: u64) -> Option<usize>

Which object the printer is laying at a file position, as an index into object_outlines: the object whose labelled block holds it, else the last laid before it; 0 for a file labelling none. Nothing before any object is laid.

Source

pub fn layer_at(&self, file_position_bytes: u64) -> Option<LayerRef>

The layer the printer is laying at a file position.

Source

pub fn layer_z_mm(&self, layer: LayerRef) -> Option<f64>

One layer’s height, when the file states it.

Source

pub fn object_layer_at_or_below(&self, layer: LayerRef) -> Option<LayerRef>

The nearest layer at or below one that lays the part rather than its supports alone, so a support-only layer still shows the part.

Source

pub fn first_object_layer(&self) -> Option<(LayerRef, u64)>

The first layer laying the part, and the file position at which it ends: the first byte of the next layer’s ;LAYER_CHANGE.

Source

pub fn layer_toolpath( &self, layer: LayerRef, ) -> Result<LayerToolpath, SpoolError>

One layer’s planned toolpath, read from that layer’s byte range of the print’s spool and never from a fresh read of the printer’s file.

§Errors

SpoolError::NoSpool for an index built with no spool, SpoolError::UnknownLayer for a layer not this index’s, and SpoolError::Io when the spool cannot be read to the layer’s end.

Source

pub fn busiest_layer(&self) -> Option<(usize, i64)>

The most extrusion types any one layer lays material under, and the file position just past that layer’s ;LAYER_CHANGE: where the plan names the most.

Source

pub fn flow_at(&self, position: i64) -> Option<SetInFile>

The flow factor the file had set by a position, when it had set one.

Source

pub fn fan_at(&self, position: i64) -> Option<SetInFile>

The part-cooling fan speed the file had set by a position, in percent, when it had set one.

Source

pub fn plan_at(&self, position: i64) -> SlicerPlan

The slicer’s plan at one file position, with no change made through this program beside what the file set.

Source

pub fn plan_with( &self, position: i64, flow_changed: Option<f64>, fan_changed: Option<f64>, ) -> SlicerPlan

The slicer’s plan at one file position, with the flow factor and fan speed changed through this program since the file last set each, when there was such a change.

Source

pub fn risen_since(&self, earlier: i64, now: i64) -> Option<f64>

The height the parts themselves have gained between two positions, in millimetres to a tenth: each layer after the earlier one’s, up to the later one’s, that lays anything but supports adds its rise over the part’s top so far, and a layer laying supports alone adds nothing, because nothing a camera watches grows there — so a support layer slicer-interleaved between two of the part’s is not the floor the next one rises from. Nothing where a position has no layer with a height.

Source

pub fn height_and_rise_since(&self, earlier: i64, now: i64) -> Option<[f64; 2]>

The part’s own top at an earlier position and the height it gains from there to a later one, each in millimetres to a tenth, as risen_since counts the gain.

Trait Implementations§

Source§

impl Clone for GcodeIndex

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GcodeIndex

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GcodeIndex

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GcodeIndex

Auto Trait Implementations§

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.