Metadata-Version: 2.5
Name: trytond_print3d_filament
Version: 8.0.0.2
Summary: Filament stock module of the print3d 3D printing management group
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: 3d printing,filament,material,spool,stock,tryton
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: trytond-currency<8.1,>=8.0
Requires-Dist: trytond-party<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Filament Stock
==============

The ``print3d_filament`` module is the filament stock of the print3d 3D
printing management group.  It holds the material profiles a spool is made
of, the storage locations a spool is kept in, the spools themselves, the
consumptions booked against them and the NFC tags stuck on them.

Features
--------

- **Material profiles**: ``print3d.filament.material`` names the family of
  the filament (PLA, PETG, ABS, TPU, PVA, Breakaway, ...), the brand that
  made it, its colour, its density and its diameter.  The density and the
  diameter are the calibration of the stock: they are what turns a weight in
  grams into a length in metres and back, and the profile carries the print
  temperature ranges and the net and tare weight defaults of a spool.  The
  profile generalises the ``ultimaker.material`` models the ``ultimaker``
  stub carried, and the vendor specific data is left to ``print3d_ultimaker``
  which extends it.
- **Weight and length**: the stock is kept in grams and in metres at once.
  ``remaining_weight`` is the filament left on a spool, computed from the
  measured gross weight and the tare of the empty reel, and
  ``remaining_length`` is that weight turned into metres with the density
  and the diameter of the material.  The conversion runs both ways, so the
  weight a print consumes is known from the length it used and the reverse.
- **Storage locations**: ``print3d.filament.stock.location`` is a shelf, a
  dry box or a cabinet a spool is kept in, with the last humidity reading of
  its sensor so that a spool kept in a box that stopped drying is
  identifiable.
- **Spools**: ``print3d.filament.spool`` is a physical reel, with its lot,
  its material, its location, the weights it is known by, its purchase data
  and its drying state.  Its lifecycle is a state machine - ``new``,
  ``reserved``, ``in_use``, ``partially_used``, ``empty``, ``retired`` - and
  is moved by the action that owns each transition and never by editing the
  record.
- **Consumptions**: ``print3d.filament.spool.consumption`` is one deduction
  from a spool, with the weight and the length it took and what was left
  afterwards.  The weigh-in wizard writes one per weighing; the print job
  lifecycle of a later milestone writes one per print.
- **Spool tags**: ``print3d.filament.spool.tag`` registers the NFC tags
  stuck on the spools.  A tag is identified by its UID - the identifier the
  chip carries and no writer can choose - and is stuck on one spool at a
  time; the record holds the format of the tag and what it was last written
  with, so that the payload of the tag and the stock of the spool are
  comparable.  A spool whose tag no longer says what it holds is flagged
  ``tag_stale`` and written again.
- **Tag layouts through a hook**: the layout of a tag is the format of a
  vendor.  The module owns the registry and the contract of a codec -
  ``TagPayload`` is what a tag carries and ``TagCodec`` the pair of
  conversions between a payload and the bytes of a tag - and the module of
  a vendor contributes the codec of its own format through the hook
  ``SpoolTag.get_codec``.  A format the module carries no codec for is a
  tag that identifies its spool by its UID alone, so the stock carries a
  vendor layout without depending on the vendor.
- **NFC reader**: ``print3d.filament.spool.tag`` is read and written by
  ``client.SpoolTagClient``, which reads the UID of the tag that is put on
  the reader, the bytes it carries, and writes an image back onto it.
  ``nfcpy`` is imported when the reader is first opened, so the module
  imports, its views load and its tests run without the library; the reader
  is configured in the ``[print3d]`` section of the configuration file of
  the server.
- **Wizards**: *Receive Spools* records a delivery of new spools and stamps
  each one a lot from a sequence; *Weigh In* takes the measured gross
  weight of a spool in use, books what was consumed and moves the spool to
  its new state; *Write Spool Tag* programs the tag of a spool and
  registers it; and *Read Spool Tag* reads a tag, compares it with the
  spool it is stuck on and, when asked to, corrects the spool with the
  filament the tag holds.

Dependencies
------------

- Tryton modules: ``ir``, ``res``, ``party``, ``currency``.

``party`` is required because a material names the brand that made it, and
``currency`` because a spool carries the price it was bought at.  The module
deliberately depends on no other module of the group: the print job
lifecycle of the core links a job to a spool, not the reverse, so the
filament stock stays usable without a printer being configured.

Models
------

- ``print3d.filament.material``: the profile a spool of filament is made of.
- ``print3d.filament.stock.location``: a place a spool is stored in.
- ``print3d.filament.spool``: a physical reel of filament.
- ``print3d.filament.spool.consumption``: one deduction from a spool.
- ``print3d.filament.spool.tag``: the registry of the NFC tags stuck on
  the spools.

Configuration
-------------

The reader of the tags is configured in the ``[print3d]`` section of the
configuration file of the server, which every module of the group shares:
``nfc_reader`` is the connection string of the reader, ``nfc_reader_type``
its kind when the connection string names no device, ``nfc_reader_timeout``
the seconds the client waits for a tag, and ``tag_length_tolerance`` the
drift, in metres, a spool may show before its tag is stale.

Security
--------

- ``group_print3d_filament``: the read-only group.  It browses the materials,
  the locations, the spools and the consumptions but does not change them.
- ``group_print3d_filament_admin``: full control over the module.
- The administration of the deployment (``res.group_admin``) is offered the
  screens as well.

Documentation
-------------

The full documentation of the module is in ``doc/index.rst``, under
*3D Printing Filament*.
