fixed the DPI settings not working Problem, and added a PNotify messsage if an Illustrator comment is detected.
This commit is contained in:
parent
179d2571ee
commit
f486a24914
2 changed files with 13 additions and 3 deletions
|
|
@ -270,7 +270,7 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
|
||||||
feedrate = max(1,data["defaultFeedrate"])
|
feedrate = max(1,data["defaultFeedrate"])
|
||||||
s.set(["defaultFeedrate"], feedrate)
|
s.set(["defaultFeedrate"], feedrate)
|
||||||
if "svgDPI" in data and data["svgDPI"]:
|
if "svgDPI" in data and data["svgDPI"]:
|
||||||
s.set(["svgDPI"], data["svgDPI"])
|
s.set_int(["svgDPI"], data["svgDPI"])
|
||||||
if "debug_logging" in data:
|
if "debug_logging" in data:
|
||||||
old_debug_logging = s.get_boolean(["debug_logging"])
|
old_debug_logging = s.get_boolean(["debug_logging"])
|
||||||
new_debug_logging = data["debug_logging"] in octoprint.settings.valid_boolean_trues
|
new_debug_logging = data["debug_logging"] in octoprint.settings.valid_boolean_trues
|
||||||
|
|
|
||||||
|
|
@ -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
|
// scale matrix
|
||||||
var mat = self.getDocumentViewBoxMatrix(doc_width, doc_height, doc_viewbox);
|
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;
|
newSvgAttrs['transform'] = scaleMatrixStr;
|
||||||
|
|
||||||
var newSvg = snap.group(f.selectAll("svg>*"));
|
var newSvg = snap.group(f.selectAll("svg>*"));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue