From fc891ac651149a445c960159c3903298109f4b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 21 Sep 2016 10:45:40 +0200 Subject: [PATCH] Make sure volume.depth for circular beds is forced to width Both width and depth should be the diameter. Adjusted docs accordingly to reflect this too. --- docs/api/printerprofiles.rst | 5 +++-- src/octoprint/printer/profile.py | 4 ++++ src/octoprint/static/js/app/viewmodels/printerprofiles.js | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/api/printerprofiles.rst b/docs/api/printerprofiles.rst index b22b8a36..668fed5b 100644 --- a/docs/api/printerprofiles.rst +++ b/docs/api/printerprofiles.rst @@ -143,11 +143,12 @@ Profile * - ``volume.width`` - 0..1 - ``float`` - - The width of the print volume + - The width of the print volume. For circular beds, the diameter of the bed. * - ``volume.depth`` - 0..1 - ``float`` - - The depth of the print volume + - The depth of the print volume. For circular beds, this is the diameter of the bed and will be forced to be the same + as ``volume.width`` upon saving. * - ``volume.height`` - 0..1 - ``float`` diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index 1e7a618a..78d73ac4 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -453,6 +453,10 @@ class PrinterProfileManager(object): if profile["volume"]["formFactor"] == BedTypes.CIRCULAR and not profile["volume"]["origin"] == BedOrigin.CENTER: profile["volume"]["origin"] = BedOrigin.CENTER + # force width and depth of volume to be identical for circular beds, with width being the reference + if profile["volume"]["formFactor"] == BedTypes.CIRCULAR: + profile["volume"]["depth"] = profile["volume"]["width"] + # validate offsets offsets = [] for offset in profile["extruder"]["offsets"]: diff --git a/src/octoprint/static/js/app/viewmodels/printerprofiles.js b/src/octoprint/static/js/app/viewmodels/printerprofiles.js index c9c100d3..074d6db3 100644 --- a/src/octoprint/static/js/app/viewmodels/printerprofiles.js +++ b/src/octoprint/static/js/app/viewmodels/printerprofiles.js @@ -281,6 +281,10 @@ $(function() { } } + if (profile.volume.formFactor == "circular") { + profile.volume.depth = profile.volume.width; + } + return profile; };