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 planned_changes(&self) -> Vec<PlannedChange>
pub fn planned_changes(&self) -> Vec<PlannedChange>
Every change the file plans, in file order: none for a file that plans none.
Sourcepub fn planned_change(&self, index: u32) -> Option<&PlannedChange>
pub fn planned_change(&self, index: u32) -> Option<&PlannedChange>
One planned change, by its index.
Sourcepub fn planned_segments(&self) -> Vec<PlannedSegment>
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.
Sourcepub fn change_waiting_at(
&self,
file_position_bytes: u64,
) -> Option<&PlannedChange>
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.
Sourcepub fn expected_color_at(&self, position: i64) -> Option<String>
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.
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 planned_head_at(
&self,
file_position_bytes: u64,
) -> Result<Option<[f64; 2]>, SpoolError>
pub fn planned_head_at( &self, file_position_bytes: u64, ) -> Result<Option<[f64; 2]>, SpoolError>
Where the plan has the nozzle in X and Y, in bed millimetres, once the
file has been read up to file_position_bytes: the last place a whole
line moved it to, read from the layer’s byte range of the print’s
spool. Nothing before the file’s first layer.
§Errors
As layer_toolpath’s, for the layer holding the
position.
Sourcepub fn planned_heads_before(
&self,
file_position_bytes: u64,
moves: usize,
) -> Result<Option<PlannedHeads>, SpoolError>
pub fn planned_heads_before( &self, file_position_bytes: u64, moves: usize, ) -> Result<Option<PlannedHeads>, SpoolError>
Where the plan has had the nozzle over the last moves moves a job at
file_position_bytes has sent, in bed millimetres, oldest first, and
where it stands after them: what a printer still working through its
queue of moves can be anywhere along. Read from the layer’s byte range
of the print’s spool, from the layer’s start at the earliest. Nothing
before the file’s first layer.
§Errors
As layer_toolpath’s, for the layer holding the
position.
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 layer_facts(
&self,
file_position_bytes: u64,
toolpath: &LayerToolpath,
) -> Option<LayerFacts>
pub fn layer_facts( &self, file_position_bytes: u64, toolpath: &LayerToolpath, ) -> Option<LayerFacts>
What a check is told of the layer a job at file_position_bytes
stands in, given that layer’s toolpath: nothing before the file’s
first layer.
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.