pub struct GcodeIndex { /* private fields */ }Expand description
One file’s slicer plan, by file position.
Implementations§
Source§impl GcodeIndex
impl GcodeIndex
Sourcepub const fn layer_count(&self) -> usize
pub const fn layer_count(&self) -> usize
How many layers the file plans.
Sourcepub const fn entries(&self) -> usize
pub const fn entries(&self) -> usize
How many entries the index holds: layers, time marks, flow and fan settings, and objects.
Sourcepub fn resident_bytes(&self) -> usize
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.
Sourcepub fn object_outlines(&self) -> &[ObjectOutline]
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.
Sourcepub fn object_at(&self, file_position_bytes: u64) -> Option<usize>
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.
Sourcepub fn layer_at(&self, file_position_bytes: u64) -> Option<LayerRef>
pub fn layer_at(&self, file_position_bytes: u64) -> Option<LayerRef>
The layer the printer is laying at a file position.
Sourcepub fn layer_z_mm(&self, layer: LayerRef) -> Option<f64>
pub fn layer_z_mm(&self, layer: LayerRef) -> Option<f64>
One layer’s height, when the file states it.
Sourcepub fn object_layer_at_or_below(&self, layer: LayerRef) -> Option<LayerRef>
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.
Sourcepub fn first_object_layer(&self) -> Option<(LayerRef, u64)>
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.
Sourcepub fn layer_toolpath(
&self,
layer: LayerRef,
) -> Result<LayerToolpath, SpoolError>
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.
Sourcepub fn busiest_layer(&self) -> Option<(usize, i64)>
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.
Sourcepub fn flow_at(&self, position: i64) -> Option<SetInFile>
pub fn flow_at(&self, position: i64) -> Option<SetInFile>
The flow factor the file had set by a position, when it had set one.
Sourcepub fn fan_at(&self, position: i64) -> Option<SetInFile>
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.
Sourcepub fn plan_at(&self, position: i64) -> SlicerPlan
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.
Sourcepub fn plan_with(
&self,
position: i64,
flow_changed: Option<f64>,
fan_changed: Option<f64>,
) -> SlicerPlan
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.
Sourcepub fn risen_since(&self, earlier: i64, now: i64) -> Option<f64>
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.
Sourcepub fn height_and_rise_since(&self, earlier: i64, now: i64) -> Option<[f64; 2]>
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.