diff --git a/src/octoprint/plugins/lasercutterprofiles/__init__.py b/src/octoprint/plugins/lasercutterprofiles/__init__.py index e721e34e..7f7ed57e 100644 --- a/src/octoprint/plugins/lasercutterprofiles/__init__.py +++ b/src/octoprint/plugins/lasercutterprofiles/__init__.py @@ -204,15 +204,17 @@ class LaserCutterProfilesPlugin(octoprint.plugin.SettingsPlugin, if self._printer.is_locked() or self._printer.is_operational(): if "volume" in new_profile: if "width" in new_profile["volume"]: - width = int(new_profile['volume']['width']) + width = float(new_profile['volume']['width']) if identifier == "_mrbeam_senior": width *= 2 + width += float(new_profile['volume']['origin_offset_x']) self._printer.commands('$130=' + str(width)) time.sleep(0.1) ### TODO find better solution then sleep if "depth" in new_profile["volume"]: - depth = int(new_profile['volume']['depth']) + depth = float(new_profile['volume']['depth']) if identifier == "_mrbeam_senior": depth *= 2 + depth += float(new_profile['volume']['origin_offset_y']) self._printer.commands('$131=' + str(depth)) new_profile["id"] = identifier diff --git a/src/octoprint/plugins/lasercutterprofiles/profile.py b/src/octoprint/plugins/lasercutterprofiles/profile.py index a8109be6..e493de03 100644 --- a/src/octoprint/plugins/lasercutterprofiles/profile.py +++ b/src/octoprint/plugins/lasercutterprofiles/profile.py @@ -29,9 +29,11 @@ class LaserCutterProfileManager(object): name = "Mr Beam", model = "Junior", volume=dict( - width = 216, - depth = 297, + width = 217, + depth = 298, height = 0, + origin_offset_x = 1, + origin_offset_y = 1, ), zAxis = False, axes=dict( diff --git a/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js b/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js index f899a951..0e50ab67 100644 --- a/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js +++ b/src/octoprint/plugins/lasercutterprofiles/static/js/lasercutterprofiles.js @@ -16,7 +16,9 @@ $(function() { formFactor: "rectangular", width: 216, depth: 297, - height: 0 + height: 0, + origin_offset_x: 1, + origin_offset_y: 1 }, zAxis: false, axes: { @@ -108,8 +110,8 @@ $(function() { self.currentProfile(currentProfile); self.currentProfileData(currentProfileData); - self.workingarea.workingAreaWidthMM(self.currentProfileData().volume.width()); - self.workingarea.workingAreaHeightMM(self.currentProfileData().volume.depth()); + self.workingarea.workingAreaWidthMM(self.currentProfileData().volume.width() - self.currentProfileData().volume.origin_offset_x()); + self.workingarea.workingAreaHeightMM(self.currentProfileData().volume.depth() - self.currentProfileData().volume.origin_offset_y()); var maxSpeed = Math.min(self.currentProfileData().axes.x.speed(), self.currentProfileData().axes.y.speed()); self.conversion.maxSpeed(maxSpeed); }; diff --git a/src/octoprint/plugins/svgtogcode/static/js/working_area.js b/src/octoprint/plugins/svgtogcode/static/js/working_area.js index 0bb9b0c2..3c0d93da 100644 --- a/src/octoprint/plugins/svgtogcode/static/js/working_area.js +++ b/src/octoprint/plugins/svgtogcode/static/js/working_area.js @@ -107,6 +107,8 @@ $(function(){ if(self.state.isOperational() && !self.state.isPrinting()){ var x = self.px2mm(event.offsetX); var y = self.px2mm(event.toElement.ownerSVGElement.offsetHeight - event.offsetY); // hopefully this works across browsers + x = Math.min(x, self.workingAreaWidthMM()); + y = Math.min(y, self.workingAreaHeightMM()); $.ajax({ url: API_BASEURL + "printer/printhead", type: "POST", diff --git a/src/octoprint/templates/mrbeam_index.jinja2 b/src/octoprint/templates/mrbeam_index.jinja2 index 99c1503f..2276b1dc 100644 --- a/src/octoprint/templates/mrbeam_index.jinja2 +++ b/src/octoprint/templates/mrbeam_index.jinja2 @@ -292,7 +292,7 @@