Skip to content

octoprint.filemanager.analysis#

AbstractAnalysisQueue #

The :class:AbstractAnalysisQueue is the parent class of all specific analysis queues such as the :class:GcodeAnalysisQueue. It offers methods to enqueue new entries to analyze and pausing and resuming analysis processing.

Parameters:

Name Type Description Default
finished_callback callable

Callback that will be called upon finishing analysis of an entry in the queue. The callback will be called with the analyzed entry as the first argument and the analysis result as returned from the queue implementation as the second parameter.

required

.. automethod:: _do_analysis

.. automethod:: _do_abort

enqueue(entry, high_priority=False) #

Enqueues an entry for analysis by the queue.

If high_priority is True (defaults to False), the entry will be prioritized and hence processed before other entries in the queue with normal priority.

Parameters:

Name Type Description Default
entry QueueEntry

The :class:QueueEntry to analyze.

required
high_priority boolean

Whether to process the provided entry with high priority (True) or not (False, default)

False

pause() #

Pauses processing of the queue, e.g. when a print is active.

resume() #

Resumes processing of the queue, e.g. when a print has finished.

AnalysisQueue #

OctoPrint's :class:AnalysisQueue can manage various :class:AbstractAnalysisQueue implementations, mapped by their machine code type.

By invoking :meth:register_finish_callback it is possible to register oneself as a callback to be invoked each time the analysis of a queue entry finishes. The call parameters will be the finished queue entry as the first and the analysis result as the second parameter. It is also possible to remove the registration again by invoking :meth:unregister_finish_callback.

:meth:enqueue allows enqueuing :class:QueueEntry instances to analyze. If the :attr:QueueEntry.type is unknown (no specific child class of :class:AbstractAnalysisQueue is registered for it), nothing will happen. Otherwise the entry will be enqueued with the type specific analysis queue.

GcodeAnalysisQueue #

Bases: AbstractAnalysisQueue

A queue to analyze GCODE files. Analysis results are :class:dict instances structured as follows:

.. list-table:: :widths: 25 70

    • Key
    • Description
    • estimatedPrintTime
    • Estimated time the file take to print, in seconds
    • filament
    • Substructure describing estimated filament usage. Keys are tool0 for the first extruder, tool1 for the second and so on. For each tool extruded length and volume (based on diameter) are provided.
    • filament.toolX.length
    • The extruded length in mm
    • filament.toolX.volume
    • The extruded volume in cm³
    • printingArea
    • Bounding box of the printed object in the print volume (minimum and maximum coordinates)
    • printingArea.minX
    • Minimum X coordinate of the printed object
    • printingArea.maxX
    • Maximum X coordinate of the printed object
    • printingArea.minY
    • Minimum Y coordinate of the printed object
    • printingArea.maxY
    • Maximum Y coordinate of the printed object
    • printingArea.minZ
    • Minimum Z coordinate of the printed object
    • printingArea.maxZ
    • Maximum Z coordinate of the printed object
    • dimensions
    • Dimensions of the printed object in X, Y, Z
    • dimensions.width
    • Width of the printed model along the X axis, in mm
    • dimensions.depth
    • Depth of the printed model along the Y axis, in mm
    • dimensions.height
    • Height of the printed model along the Z axis, in mm

QueueEntry #

Bases: collections.namedtuple('QueueEntry', 'name, path, type, location, absolute_path, printer_profile, analysis')

A :class:QueueEntry for processing through the :class:AnalysisQueue. Wraps the entry's properties necessary for processing.

Parameters:

Name Type Description Default
name str

Name of the file to analyze.

required
path str

Storage location specific path to the file to analyze.

required
type str

Type of file to analyze, necessary to map to the correct :class:AbstractAnalysisQueue sub class. At the moment, only gcode is supported here.

required
location str

Location the file is located on.

required
absolute_path str

Absolute path on disk through which to access the file.

required
printer_profile PrinterProfile

:class:PrinterProfile which to use for analysis.

required
analysis dict

:class:GcodeAnalysisQueue results from prior analysis, or None if there is none.

required
Back to top