diff --git a/docs/api/printerprofiles.rst b/docs/api/printerprofiles.rst index 92e144e7..215d201b 100644 --- a/docs/api/printerprofiles.rst +++ b/docs/api/printerprofiles.rst @@ -173,6 +173,10 @@ Profile - 0..1 - Object - Information about the printer's extruders + * - ``extruder.nozzleDiameter`` + - 0..1 + - ``float`` + - The diameter of the printer's nozzle(s) in mm. * - ``extruder.count`` - 0..1 - ``int`` diff --git a/src/octoprint/plugins/cura/profile.py b/src/octoprint/plugins/cura/profile.py index 199846de..f1bff514 100644 --- a/src/octoprint/plugins/cura/profile.py +++ b/src/octoprint/plugins/cura/profile.py @@ -46,7 +46,6 @@ defaults = dict( layer_height=0.1, wall_thickness=0.8, solid_layer_thickness=0.6, - nozzle_size=0.4, print_temperature=[220, 0, 0, 0], print_bed_temperature=70, platform_adhesion=PlatformAdhesionTypes.NONE, @@ -757,7 +756,7 @@ class Profile(object): def calculate_edge_width_and_line_count(self): wall_thickness = self.get_float("wall_thickness") - nozzle_size = self.get_float("nozzle_size") + nozzle_size = self._printer_profile["extruder"]["nozzleDiameter"] if self.get_boolean("spiralize") or self.get_boolean("follow_surface"): return wall_thickness, 1 diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index f87aab1f..4a582530 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -38,7 +38,8 @@ class PrinterProfileManager(object): count = 1, offsets = [ (0, 0) - ] + ], + nozzleDiameter = 0.4 ), axes=dict( x = dict(speed=6000, inverted=False), @@ -150,7 +151,7 @@ class PrinterProfileManager(object): if profile is None: continue - results[identifier] = profile + results[identifier] = dict_merge(self._load_default(), profile) return results def _load_all_identifiers(self): @@ -183,7 +184,7 @@ class PrinterProfileManager(object): import yaml with open(path, "wb") as f: try: - yaml.safe_dump(profile, f) + yaml.safe_dump(profile, f, default_flow_style=False, indent=" ", allow_unicode=True) except Exception as e: raise SaveError("Cannot save profile %s: %s" % (profile["id"], e.message)) diff --git a/src/octoprint/static/js/app/viewmodels/printerprofiles.js b/src/octoprint/static/js/app/viewmodels/printerprofiles.js index e7f70a4f..5d2e4ee5 100644 --- a/src/octoprint/static/js/app/viewmodels/printerprofiles.js +++ b/src/octoprint/static/js/app/viewmodels/printerprofiles.js @@ -24,7 +24,8 @@ function PrinterProfilesViewModel() { count: 1, offsets: [ [0,0] - ] + ], + nozzleDiameter: 0.4 } } }; @@ -64,6 +65,7 @@ function PrinterProfilesViewModel() { self.editorHeatedBed = ko.observable(); + self.editorNozzleDiameter = ko.observable(); self.editorExtruders = ko.observable(); self.editorExtruderOffsets = ko.observableArray(); @@ -215,6 +217,7 @@ function PrinterProfilesViewModel() { self.editorHeatedBed(data.volume.heatedBed); + self.editorNozzleDiameter(data.extruder.nozzleDiameter); self.editorExtruders(data.extruder.count); var offsets = []; _.each(data.extruder.offsets, function(offset) { @@ -275,7 +278,8 @@ function PrinterProfilesViewModel() { count: self.editorExtruders(), offsets: [ [0.0, 0.0] - ] + ], + nozzleDiameter: self.editorNozzleDiameter() }, axes: { x: { @@ -306,6 +310,6 @@ function PrinterProfilesViewModel() { return profile; }; - self.onSettingsShown = self.requestData; + self.onSettingsShown = self.requestData; self.onStartup = self.requestData; } \ No newline at end of file diff --git a/src/octoprint/templates/settings.jinja2 b/src/octoprint/templates/settings.jinja2 index b08585c2..02e917d7 100644 --- a/src/octoprint/templates/settings.jinja2 +++ b/src/octoprint/templates/settings.jinja2 @@ -240,6 +240,15 @@ +
+ +
+
+ + mm +
+
+