Access and Documentation System for the Fab Lab that logs temperature data of ongoing prints, makes data available through an API and offers the possibility to control prints. It acts as an interface for printers located in the Fab Lab.
- Manage existing Printers under http://localhost:8000/manage/ (is_staff required)
- Register a new Account http://localhost:8000/register/ and Login to create a session http://localhost:8000/login/
- Access the REST API in order to
- start/stop prints
- get data from the system
- post data to the system
- PrintJobs will be created internally in order to log temperature data of prints
The Project is based on Django.
- Latest Version of Docker and a Docker Account
- Check Python Version
$ python --version
- If you don't have Python installed, install Python 3.9.0 or higher
- Run the Docker Compose file
docker-compose run --build
- Go to http://localhost:5000/ and follow the basic setup wizard and create an account
- Create a terminal in your 'web'-container and run the following commands:
$ python manage.py makemigrations
$ python manage.py migrate
This will make sure the database has all the models to work with
- Go to http://localhost:5000/ and under
Settings > OCTOPRINT > Pluginmanager
install the MQTT Plugin (by Gina Häußge) - Under
Settings > PLUGINS > MQTT > Broker
set:- Host =
mqtt
- Port =
1883
- Username =
testuser
- Passwort =
testpasswd
- Host =
- Under
Settings > PLUGINS > MQTT > Topics
set:- Basic topic =
fablab/printers/testprinter/
- Basic topic =
- Run Docker Compose again
docker-compose run --build
- Go to http://localhost:8000/register/ and create an Account
The Api (http://localhost:8000/api/) should now be available to you. In order to access the "Manage Printers"-tab (http://localhost:8000/manage/) you need to access the database directly and change your just created User to is_staff=true
and is_superuser=true
PyCharm is a very popular and one of the best IDE for developing python application. You can download and install PyCharm by following below steps:
- Go to https://www.jetbrains.com/pycharm/ and select your required OS.
- For developing python ,download the Community version.
- Install PyCharm.
- Open PyCharm and select 'do not import settings' in the dialog box.
- Your Pycharm is ready for use. Select Open and choose accesslog project for development.
Run tests with the following command:
$ python manage.py test
- POST
http://localhost:8000/api/print/
- allows to start a new Print Job providing: GCode ID, Machine ID
- Returns on successful request:
HTTP 201 Create
Example successful response:
{
"done": false,
"files": {
"local": {
"name": "boat_1HhpkoU.gcode",
"origin": "local",
"path": "boat_1HhpkoU.gcode",
"refs": {
"download": "http://octoprint:5000/downloads/files/local/boat_1HhpkoU.gcode",
"resource": "http://octoprint:5000/api/files/local/boat_1HhpkoU.gcode"
}
},
"sdcard": {
"name": "boat_1~1.gco",
"origin": "sdcard",
"path": "boat_1~1.gco",
"refs": {
"resource": "http://octoprint:5000/api/files/sdcard/boat_1~1.gco"
}
}
}
}
- POST
http://localhost:8000/api/stopprint/
- allows to stop an ongoing Print Job providing: PrintJob ID
- Permissions: Owner of Print Job
- Returns on successful request:
HTTP 204 No Content
Example successful response:
[]
- GET
http://localhost:8000/api/users/
- returns all users
- Returns on successful request:
HTTP 200 Ok
Example successful response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"url": "http://localhost:8000/api/users/1/",
"username": "superuser",
"email": "",
"groups": []
}
]
}
- GET
http://localhost:8000/api/groups/
- returns all groups
- Returns on successful request:
HTTP 200 Ok
Example successful response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"url": "http://localhost:8000/api/groups/1/",
"name": "Testgroup"
}
]
}
- GET
http://localhost:8000/api/models/
- returns all models that are owned by the user or shared with the user
- Returns on successful request:
HTTP 200 Ok
Example successful response (Logged in UserID:1):
[
{
"id": 1,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "/upload/models/ghost_92lAXd9.stl",
"Uploaded": "2021-10-19T10:57:44.211590+02:00",
"Owner": 1,
"Previous": null,
"SharedWithUser": null
},
{
"id": 2,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "/upload/models/ghost_lsaRxE9.stl",
"Uploaded": "2021-10-19T10:58:13.225555+02:00",
"Owner": 1,
"Previous": null,
"SharedWithUser": 2
}
]
- GET
http://localhost:8000/api/models/?id=MODELID
- returns single model with id provided the user is owner or the model is shared with the user
- Returns on successful request:
HTTP 200 Ok
Example successful response (?id=1, Logged in UserID:1):
{
"id": 1,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "/upload/models/ghost_92lAXd9.stl",
"Uploaded": "2021-10-19T10:57:44.211590+02:00",
"Owner": 1,
"Previous": null,
"SharedWithUser": null
}
- GET
http://localhost:8000/api/models/?name=MODELNAME
- returns all models with that name provided the user is owner or the model is shared with the user
- Returns on successful request:
HTTP 200 Ok
Example successful response (?name=ghost, Logged in UserID:1):
[
{
"id": 1,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "/upload/models/ghost_92lAXd9.stl",
"Uploaded": "2021-10-19T10:57:44.211590+02:00",
"Owner": 1,
"Previous": null,
"SharedWithUser": null
},
{
"id": 2,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "/upload/models/ghost_lsaRxE9.stl",
"Uploaded": "2021-10-19T10:58:13.225555+02:00",
"Owner": 1,
"Previous": null,
"SharedWithUser": 2
}
]
- GET
http://localhost:8000/api/models/MODELID/
- returns single model with all details
- Returns on successful request:
HTTP 200 Ok
Example successful response (MODELID=1):
{
"id": 1,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "http://localhost:8000/upload/models/ghost_92lAXd9.stl",
"Uploaded": "2021-10-19T10:57:44.211590+02:00",
"Owner": 1,
"Previous": null,
"SharedWithUser": null
}
- POST
http://localhost:8000/api/models/
- allows adding of new models providing: File, Previous (optional), SharedWithUser (optional)
- Returns on successful request:
HTTP 201 Created
Example successful response (Logged in UserID:1):
{
"id": 7,
"Name": "ghost",
"FileName": "ghost.stl",
"Size": "3501284",
"File": "/upload/models/ghost.stl",
"Uploaded": "2021-11-16T12:13:06.155228+01:00",
"Owner": 1,
"Previous": 4,
"SharedWithUser": 2
}
- GET
http://localhost:8000/api/gcode/
- returns all gcodes that are owned by the user or shared with the user
- Returns on successful request:
HTTP 200 OK
Example successful response (Logged in UserID:1):
[
{
"id": 8,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "/upload/gcode/boat_pWiZ5oi.gcode",
"Uploaded": "2021-11-15T12:21:47.197334+01:00",
"UsedFilamentInG": 0.0,
"Owner": 1,
"UsedFilamentInMm": 0.0,
"SharedWithUser": null,
"EstimatedPrintingTime": "11:21:47.187739",
"ThreeDimensionalModel": null
},
{
"id": 9,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "/upload/gcode/boat_1HhpkoU.gcode",
"Uploaded": "2021-11-15T12:26:48.249209+01:00",
"UsedFilamentInG": 123.0,
"Owner": 1,
"UsedFilamentInMm": 2132.0,
"SharedWithUser": 3,
"EstimatedPrintingTime": "12:30:00",
"ThreeDimensionalModel": 1
}
]
- GET
http://localhost:8000/api/gcode/?id=GCODEID
- returns single gcodes with id provided the user is owner or the model is shared with the user
- Returns on successful request:
HTTP 200 OK
Example successful response (?id=1, Logged in UserID:1):
{
"id": 8,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "/upload/gcode/boat_pWiZ5oi.gcode",
"Uploaded": "2021-11-15T12:21:47.197334+01:00",
"UsedFilamentInG": 0.0,
"Owner": 1,
"UsedFilamentInMm": 0.0,
"SharedWithUser": null,
"EstimatedPrintingTime": "11:21:47.187739",
"ThreeDimensionalModel": null
}
- GET
http://localhost:8000/api/gcode/?name=GCODENAME
- returns all gcodes with that name provided the user is owner or the model is shared with the user
- Returns on successful request:
HTTP 200 OK
Example successful response (?name=boat, Logged in UserID:1):
[
{
"id": 8,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "/upload/gcode/boat_pWiZ5oi.gcode",
"Uploaded": "2021-11-15T12:21:47.197334+01:00",
"UsedFilamentInG": 0.0,
"Owner": 1,
"UsedFilamentInMm": 0.0,
"SharedWithUser": null,
"EstimatedPrintingTime": "11:21:47.187739",
"ThreeDimensionalModel": null
},
{
"id": 9,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "/upload/gcode/boat_1HhpkoU.gcode",
"Uploaded": "2021-11-15T12:26:48.249209+01:00",
"UsedFilamentInG": 123.0,
"Owner": 1,
"UsedFilamentInMm": 2132.0,
"SharedWithUser": 3,
"EstimatedPrintingTime": "12:30:00",
"ThreeDimensionalModel": 1
}
]
- GET
http://localhost:8000/api/gcode/MODELID/
- returns single model with all details
- Returns on successful request:
HTTP 200 OK
Example successful response (MODELID=8):
{
"id": 8,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "http://localhost:8000/upload/gcode/boat_pWiZ5oi.gcode",
"Uploaded": "2021-11-15T12:21:47.197334+01:00",
"UsedFilamentInG": 0.0,
"Owner": 1,
"UsedFilamentInMm": 0.0,
"SharedWithUser": null,
"EstimatedPrintingTime": "11:21:47.187739",
"ThreeDimensionalModel": null
}
- POST
http://localhost:8000/api/gcode/
- allows adding of new models providing: File, UsedFilamentInG, UsedFilamentInMm, SharedWithUser (optional), EstimatedPrintingTime, ThreeDimensionalModel (optional)
- Returns on successful request:
HTTP 201 Created
Example successful response (Logged in UserID:1):
{
"id": 10,
"Name": "boat",
"FileName": "boat.gcode",
"Size": "562833",
"File": "/upload/gcode/boat_H4zM6xZ.gcode",
"Uploaded": "2021-11-16T13:43:18.135579+01:00",
"UsedFilamentInG": 123.0,
"Owner": 1,
"UsedFilamentInMm": 12323.0,
"SharedWithUser": 3,
"EstimatedPrintingTime": "12:33:00",
"ThreeDimensionalModel": 3
}
- GET
http://localhost:8000/api/slicingconfig/
- returns all sclicing configs in a list
- Configs in JSON format
- Returns on successful request:
HTTP 200 OK
Example successful response:
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"Config": [
{
"dummy0": "1-770-736-8031 x56442",
"dummy1": 1,
"dummy2": "Leanne Graham",
"dummy3": "Bret",
"dummy4": "[email protected]"
}
],
"GCode": 10
},
{
"Config": [
{
"dummy0": "1-770-736-8031 x56442",
"dummy1": 1,
"dummy2": "Leanne Graham",
"dummy3": "Bret",
"dummy4": "[email protected]"
}
],
"GCode": 9
}
]
}
- GET
http://localhost:8000/api/slicingconfig/GCODEID/
- returns slicing config of gcode in json format providing
GCODEID
- Returns on successful request:
HTTP 200 OK
- returns slicing config of gcode in json format providing
Example successful response:
[
{
"dummy0": "1-770-736-8031 x56442",
"dummy1": 1,
"dummy2": "Leanne Graham",
"dummy3": "Bret",
"dummy4": "[email protected]"
}
]
- POST
http://localhost:8000/api/slicingconfig/
- allows to add new slicing config in json format providing: Config, GCodeID
- Returns on successful request:
HTTP 201 Created
Example successful response (returns saved JSON Config):
[
{
"dummy0": "1-770-736-8031 x56442",
"dummy1": 1,
"dummy2": "Leanne Graham",
"dummy3": "Bret",
"dummy4": "[email protected]"
}
]
- GET
http://localhost:8000/api/printjob/
- returns all PrintJobs in a list owned by logged in User
- Returns on successful request:
HTTP 200 OK
Example successful response (Logged in UserID:1):
[
{
"id": 1478,
"User": 1,
"Machine": 17,
"GCode": 9,
"Start": "2021-11-15T17:12:42.932473+01:00",
"End": "2021-11-15T17:17:37.710299+01:00",
"State": 0
},
{
"id": 1479,
"User": 1,
"Machine": 17,
"GCode": 9,
"Start": "2021-11-15T17:19:38.623075+01:00",
"End": "2021-11-15T17:24:33.783123+01:00",
"State": 0
}
]
- GET
http://localhost:8000/api/printjob/PRINTJOBID
- returns detailed information about a single PrintJob
- Returns on successful request:
HTTP 200 OK
Example successful response (PRINTJOBID:1476):
{
"id": 1476,
"User": 1,
"Machine": 17,
"GCode": 9,
"Start": "2021-11-15T16:04:04.274812+01:00",
"End": "2021-11-15T16:04:04.274820+01:00",
"State": 0
}
- POST
http://localhost:8000/api/printjob/
- allows to add new PrintJobs providing: Machine, GCode, Start, End, State
- Returns on successful request:
HTTP 201 Created
Example successful response (Logged in UserID:1):
{
"id": 1494,
"User": 1,
"Machine": 12,
"GCode": 10,
"Start": "2021-11-17T10:51:00+01:00",
"End": "2021-11-17T10:53:00+01:00",
"State": 0
}
- GET
http://localhost:8000/api/mediafile/
- returns all mediafiles
- Returns on successful request:
HTTP 200 OK
Example successful response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 5,
"PrintJob": 1478,
"File": "http://localhost:8000/upload/printmedia/New_York_City_High-Quality_Wallpaper_Pack.jpg",
"Owner": 1
}
]
}
- GET
http://localhost:8000/api/mediafile/MEDIAFILEID
- returns detailed information (including download link) about a single Media File providing
MEDIAFILEID
- Returns on successful request:
HTTP 200 OK
- returns detailed information (including download link) about a single Media File providing
Example successful response:
{
"id": 5,
"PrintJob": 1478,
"File": "http://localhost:8000/upload/printmedia/New_York_City_High-Quality_Wallpaper_Pack.jpg",
"Owner": 1
}
- GET
http://localhost:8000/api/mediafiles/PRINTJOBID
- returns all Media Files related to a PrintJob providing
PRINTJOBID
- Returns on successful request:
HTTP 200 OK
- returns all Media Files related to a PrintJob providing
Example successful response:
[
{
"id": 5,
"PrintJob": 1478,
"File": "/upload/printmedia/New_York_City_High-Quality_Wallpaper_Pack.jpg",
"Owner": 1
}
]
- POST
http://localhost:8000/api/mediafile/
- allows to add new PrintMediaFiles providing: PrintJobID, File
- Logged in User also needs to be owner of related Print Job
- Returns on successful request:
HTTP 201 Created
Example successful response (Logged in UserID:1):
{
"id": 5,
"PrintJob": 1478,
"File": "http://localhost:8000/upload/printmedia/New_York_City_High-Quality_Wallpaper_Pack.jpg",
"Owner": 1
}
-
Multithreading
- Multiple Instances of the paho mqtt client for each Machine
-
Improvement to the Front-End
- Mobile responsiveness
- Increase User Experience (UX)
- Language localisation
- Increase overall visibility
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.