diff --git a/src/octoprint/plugins/svgtogcode/__init__.py b/src/octoprint/plugins/svgtogcode/__init__.py index 123e8630..4b65fb0c 100644 --- a/src/octoprint/plugins/svgtogcode/__init__.py +++ b/src/octoprint/plugins/svgtogcode/__init__.py @@ -270,7 +270,7 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin, feedrate = max(1,data["defaultFeedrate"]) s.set(["defaultFeedrate"], feedrate) if "svgDPI" in data and data["svgDPI"]: - s.set(["svgDPI"], data["svgDPI"]) + s.set_int(["svgDPI"], data["svgDPI"]) if "debug_logging" in data: old_debug_logging = s.get_boolean(["debug_logging"]) new_debug_logging = data["debug_logging"] in octoprint.settings.valid_boolean_trues @@ -344,7 +344,7 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin, if not machinecode_path: path, _ = os.path.splitext(model_path) machinecode_path = path + ".gco" - + self._svgtogcode_logger.info("### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path)) ## direct call diff --git a/src/octoprint/plugins/svgtogcode/static/js/working_area.js b/src/octoprint/plugins/svgtogcode/static/js/working_area.js index 3af0b1e4..3aafd98a 100644 --- a/src/octoprint/plugins/svgtogcode/static/js/working_area.js +++ b/src/octoprint/plugins/svgtogcode/static/js/working_area.js @@ -268,9 +268,19 @@ $(function(){ } } + // find Illustrator comment and notify + f.node.childNodes.forEach(function(entry) { + if(entry.nodeType == 8) { // Nodetype 8 = comment + if(entry.textContent.indexOf('Illustrator') > -1) { + new PNotify({title: gettext("Illustrator SVG Detected"), text: "Looks like an Illustrator SVG! If the scale is not right, and you want to change the DPI, please go to the \'Settings\' menu and change the \'SVG dpi\' field under \'Plugins/Svg Conversion\' and add the file again.", type: "info", hide: false}); + } + } + }); + // scale matrix var mat = self.getDocumentViewBoxMatrix(doc_width, doc_height, doc_viewbox); - var scaleMatrixStr = new Snap.Matrix(mat[0][0],mat[0][1],mat[1][0],mat[1][1],mat[0][2],mat[1][2]).toTransformString(); + var dpiscale = 90 / self.settings.settings.plugins.svgtogcode.svgDPI(); + var scaleMatrixStr = new Snap.Matrix(mat[0][0],mat[0][1],mat[1][0],mat[1][1],mat[0][2],mat[1][2]).scale(dpiscale).toTransformString(); newSvgAttrs['transform'] = scaleMatrixStr; var newSvg = snap.group(f.selectAll("svg>*"));