Compare commits
2 commits
stable-1.2
...
mrbeam-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0aad8846c | ||
|
|
7dd03d08e5 |
15 changed files with 8306 additions and 2045 deletions
|
|
@ -1,6 +1,5 @@
|
|||
OctoPrint
|
||||
=========
|
||||
What I did was take the MrBeam fork of Octoprint (because I have a MrBeam, and I like it) - and modify it for pen plotting with an axidraw v3 clone.
|
||||
|
||||
[](https://flattr.com/submit/auto?user_id=foosel&url=https://github.com/foosel/OctoPrint&title=OctoPrint&language=&tags=github&category=software)
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -97,7 +97,7 @@ def update_source(git_executable, folder, target, force=False):
|
|||
raise RuntimeError("Could not update, \"git reset --hard\" failed with returncode %d: %s" % (returncode, stdout))
|
||||
|
||||
print(">>> Running: git pull")
|
||||
returncode, stdout = _git(["pull", "origin", "stable-1.2.2"], folder, git_executable=git_executable)
|
||||
returncode, stdout = _git(["pull"], folder, git_executable=git_executable)
|
||||
if returncode != 0:
|
||||
raise RuntimeError("Could not update, \"git pull\" failed with returncode %d: %s" % (returncode, stdout))
|
||||
print(stdout)
|
||||
|
|
|
|||
|
|
@ -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_int(["svgDPI"], data["svgDPI"])
|
||||
s.set(["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
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ defaults = dict(
|
|||
# general settings
|
||||
svgDPI = 90,
|
||||
pierce_time = 0,
|
||||
|
||||
|
||||
# vector settings
|
||||
speed = 300,
|
||||
intensity = 500,
|
||||
|
|
@ -24,7 +24,7 @@ defaults = dict(
|
|||
cross_fill = False,
|
||||
fill_angle = 0,
|
||||
fill_spacing = 0.25,
|
||||
|
||||
|
||||
# pixel settings
|
||||
beam_diameter = 0.25,
|
||||
intensity_white = 0,
|
||||
|
|
@ -251,8 +251,8 @@ class Profile(object):
|
|||
}
|
||||
|
||||
return settings
|
||||
|
||||
|
||||
|
||||
|
||||
def convert_to_engine2(self):
|
||||
|
||||
settings = {
|
||||
|
|
|
|||
|
|
@ -41,10 +41,8 @@ $(function(){
|
|||
// image engraving stuff
|
||||
// preset values are a good start for wood engraving
|
||||
self.images_placed = ko.observable(false);
|
||||
self.text_placed = ko.observable(false);
|
||||
self.show_image_parameters = ko.computed(function(){
|
||||
return (self.images_placed() || self.text_placed()
|
||||
|| (self.fill_areas() && self.show_vector_parameters()));
|
||||
return self.images_placed() || (self.fill_areas() && self.show_vector_parameters());
|
||||
});
|
||||
self.imgIntensityWhite = ko.observable(0);
|
||||
self.imgIntensityBlack = ko.observable(500);
|
||||
|
|
@ -87,7 +85,6 @@ $(function(){
|
|||
self.show_vector_parameters(self.workingArea.getPlacedSvgs().length > 0);
|
||||
self.show_fill_areas_checkbox(self.workingArea.hasFilledVectors())
|
||||
self.images_placed(self.workingArea.getPlacedImages().length > 0);
|
||||
self.text_placed(self.workingArea.hasTextItems());
|
||||
//self.show_image_parameters(self.workingArea.getPlacedImages().length > 0);
|
||||
|
||||
if(self.show_vector_parameters() || self.show_image_parameters()){
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// Drag, Scale & Rotate - a snapsvg.io plugin to free transform objects in an svg.
|
||||
// Copyright (C) 2015 Teja Philipp <osd@tejaphilipp.de>
|
||||
//
|
||||
//
|
||||
// heavily inspired by http://svg.dabbles.info
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
|
||||
Snap.plugin(function (Snap, Element, Paper, global) {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @returns {undefined}
|
||||
*/
|
||||
Element.prototype.transformable = function () {
|
||||
|
|
@ -35,13 +35,13 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
elem.click(function(){ elem.ftCreateHandles() });
|
||||
return elem;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Adds transparent fill if not present.
|
||||
* This is useful for dragging the element around.
|
||||
*
|
||||
* Adds transparent fill if not present.
|
||||
* This is useful for dragging the element around.
|
||||
*
|
||||
* @returns {path}
|
||||
*/
|
||||
Element.prototype.add_fill = function(){
|
||||
|
|
@ -67,7 +67,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Free transform plugin heavily inspired by http://svg.dabbles.info
|
||||
*/
|
||||
|
|
@ -76,16 +76,16 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
Snap.plugin( function( Snap, Element, Paper, global ) {
|
||||
|
||||
var ftOption = {
|
||||
handleFill: "red",
|
||||
handleFill: "blue",
|
||||
handleStrokeDashPreset: [5,5],
|
||||
handleStrokeWidth: 2,
|
||||
handleLength: 18,
|
||||
handleRadius: 16,
|
||||
handleRadius: 16,
|
||||
unscale: 1,
|
||||
handleStrokeDash: "5,5",
|
||||
handleStrokeDash: "5,5"
|
||||
};
|
||||
|
||||
Element.prototype.ftToggleHandles = function(){
|
||||
|
||||
Element.prototype.ftToggleHandles = function(){
|
||||
if(this.data('handlesGroup')){
|
||||
this.ftRemoveHandles();
|
||||
} else {
|
||||
|
|
@ -97,31 +97,39 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
this.ftInit();
|
||||
var freetransEl = this;
|
||||
var bb = freetransEl.getBBox();
|
||||
|
||||
|
||||
var rotateDragger = this.paper.select('#userContent').circle(bb.cx + bb.width/2 + ftOption.handleLength * ftOption.unscale, bb.cy, ftOption.handleRadius * ftOption.unscale ).attr({ fill: ftOption.handleFill });
|
||||
var translateDragger = this.paper.select('#userContent').circle(bb.cx, bb.cy, ftOption.handleRadius * ftOption.unscale).attr({ fill: ftOption.handleFill });
|
||||
|
||||
var resizeDragger = this.paper.select('#userContent').circle(bb.cx + bb.width/2, bb.cy - bb.height/2, ftOption.handleRadius * ftOption.unscale).attr({ fill: ftOption.handleFill});
|
||||
|
||||
var joinLine = freetransEl.ftDrawJoinLine( rotateDragger, ftOption.handleStrokeWidth * ftOption.unscale);
|
||||
var handlesGroup = this.paper.select('#userContent').g( joinLine, rotateDragger, translateDragger );
|
||||
var handlesGroup = this.paper.select('#userContent').g( joinLine, rotateDragger, translateDragger, resizeDragger );
|
||||
|
||||
freetransEl.data( "handlesGroup", handlesGroup );
|
||||
freetransEl.data( "joinLine", joinLine);
|
||||
|
||||
freetransEl.data( "scaleFactor", calcDistance( bb.cx, bb.cy, rotateDragger.attr('cx'), rotateDragger.attr('cy') ) );
|
||||
freetransEl.data( "scaleFactor", calcDistance( bb.cx, bb.cy, resizeDragger.attr('cx'), resizeDragger.attr('cy') ) );
|
||||
|
||||
translateDragger.drag(
|
||||
elementDragMove.bind( translateDragger, freetransEl ),
|
||||
translateDragger.drag(
|
||||
elementDragMove.bind( translateDragger, freetransEl ),
|
||||
elementDragStart.bind( translateDragger, freetransEl ),
|
||||
elementDragEnd.bind( translateDragger, freetransEl )
|
||||
elementDragEnd.bind( translateDragger, freetransEl )
|
||||
);
|
||||
|
||||
freetransEl.unclick();
|
||||
freetransEl.data("click", freetransEl.click( function() { this.ftRemoveHandles() } ) );
|
||||
|
||||
rotateDragger.drag(
|
||||
dragHandleRotateMove.bind( rotateDragger, freetransEl ),
|
||||
resizeDragger.drag(
|
||||
dragHandleResizeMove.bind(resizeDragger,freetransEl),
|
||||
dragHandleResizeStart.bind(resizeDragger, freetransEl),
|
||||
dragHandleResizeEnd.bind(resizeDragger, freetransEl)
|
||||
|
||||
);
|
||||
|
||||
rotateDragger.drag(
|
||||
dragHandleRotateMove.bind( rotateDragger, freetransEl ),
|
||||
dragHandleRotateStart.bind( rotateDragger, freetransEl ),
|
||||
dragHandleRotateEnd.bind( rotateDragger, freetransEl )
|
||||
dragHandleRotateEnd.bind( rotateDragger, freetransEl )
|
||||
);
|
||||
freetransEl.ftStoreInitialTransformMatrix();
|
||||
freetransEl.ftHighlightBB();
|
||||
|
|
@ -134,7 +142,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
this.data("tx", 0);
|
||||
this.data("ty", 0);
|
||||
this.attr({class:'_freeTransformInProgress'});
|
||||
|
||||
|
||||
ftOption.unscale = 1 / this.paper.select('#scaleGroup').transform().localMatrix.a;
|
||||
this.data('unscale', ftOption.unscale);
|
||||
ftOption.handleStrokeDash = ftOption.handleStrokeDashPreset.map(function(v){ return v*ftOption.unscale; }).join(',');
|
||||
|
|
@ -153,11 +161,11 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
this.data('ocy', this.attr('cy') );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Element.prototype.ftStoreInitialTransformMatrix = function() {
|
||||
this.data('initialTransformMatrix', this.transform().localMatrix );
|
||||
return this;
|
||||
};
|
||||
};
|
||||
|
||||
Element.prototype.ftGetInitialTransformMatrix = function() {
|
||||
return this.data('initialTransformMatrix');
|
||||
|
|
@ -191,10 +199,10 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
Element.prototype.ftUpdateTransform = function() {
|
||||
//console.log("translate: ", this.data('tx'), this.data('ty'), 'rotate: ', this.data('angle'), 'scale: ', this.data('scale'));
|
||||
var tstring = "t" + this.data("tx") + "," + this.data("ty") + this.ftGetInitialTransformMatrix().toTransformString() + "r" + this.data("angle") + 'S' + this.data("scale" );
|
||||
var tstring = "t" + this.data("tx") + "," + this.data("ty") + this.ftGetInitialTransformMatrix().toTransformString() + "r" + this.data("angle") + 'S' + this.data("scale" );
|
||||
this.attr({ transform: tstring });
|
||||
this.data("bbT") && this.ftHighlightBB(this.paper.select('#userContent'));
|
||||
this.ftReportTransformation();
|
||||
|
|
@ -204,17 +212,18 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
Element.prototype.ftHighlightBB = function() {
|
||||
this.data("bbT") && this.data("bbT").remove();
|
||||
this.data("bb") && this.data("bb").remove();
|
||||
|
||||
|
||||
// transformed bbox
|
||||
this.data("bbT", this.paper.rect( rectObjFromBB( this.getBBox(1) ) )
|
||||
.attr({ fill: "none", stroke: ftOption.handleFill, strokeWidth: ftOption.handleStrokeWidth, strokeDasharray: ftOption.handleStrokeDashPreset.join(',') })
|
||||
.transform( this.transform().global.toString() ) );
|
||||
.attr({ fill: "none", 'vector-effect': "non-scaling-stroke", stroke: ftOption.handleFill, strokeWidth: ftOption.handleStrokeWidth, strokeDasharray: ftOption.handleStrokeDashPreset.join(',') })
|
||||
.transform( this.transform().global.toString() ) );
|
||||
|
||||
// outer bbox
|
||||
this.data("bb", this.paper.select('#userContent').rect( rectObjFromBB( this.getBBox() ) )
|
||||
.attr({ fill: "none", stroke: 'gray', strokeWidth: ftOption.handleStrokeWidth, strokeDasharray: ftOption.handleStrokeDash }) );
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
Element.prototype.ftReportTransformation = function(){
|
||||
if(this.data('ftCallbacks') && this.data('ftCallbacks').length > 0){
|
||||
for (var idx = 0; idx < this.data('ftCallbacks').length; idx++) {
|
||||
|
|
@ -230,9 +239,9 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
this.data('ftCallbacks').push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Element.prototype.ftDisableRotate = function(){
|
||||
this.data('block_rotation', true);
|
||||
this.data('block_rotation', true);
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -254,7 +263,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var dragHandle = this;
|
||||
var unscale = mainEl.data('unscale');
|
||||
var bb = mainEl.data('obb');
|
||||
|
||||
|
||||
var udx = dx*unscale;
|
||||
var udy = dy*unscale;
|
||||
|
||||
|
|
@ -281,37 +290,58 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
function elementDragEnd( mainEl, dx, dy, x, y ) {
|
||||
};
|
||||
|
||||
function dragHandleResizeStart( mainElement ) {
|
||||
this.ftStoreStartCenter();
|
||||
};
|
||||
|
||||
function dragHandleResizeEnd( mainElement ) {
|
||||
};
|
||||
|
||||
|
||||
function dragHandleResizeMove( mainEl, dx, dy, x, y, event){
|
||||
var handle = this;
|
||||
var mainBB = mainEl.getBBox();
|
||||
var unscale = mainEl.data('unscale');
|
||||
|
||||
//todo was ist ocx
|
||||
handle.attr({ cx:+handle.data('ocx') + dx*unscale, cy: +handle.data('ocy')+dy*unscale});
|
||||
|
||||
var distance = calcDistance(mainBB.cx,mainBB.cy,handle.attr('cx'),handle.attr('cy'));
|
||||
var scale = distance / mainEl.data("scaleFactor");
|
||||
if(event.shiftKey){
|
||||
scale = Math.round(scale*4) / 4;
|
||||
}
|
||||
|
||||
mainEl.data("scale", scale );
|
||||
|
||||
mainEl.ftUpdateTransform();
|
||||
|
||||
};
|
||||
|
||||
function dragHandleRotateStart( mainElement ) {
|
||||
this.ftStoreStartCenter();
|
||||
};
|
||||
|
||||
function dragHandleRotateEnd( mainElement ) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
function dragHandleRotateMove( mainEl, dx, dy, x, y, event ) {
|
||||
var handle = this;
|
||||
var mainBB = mainEl.getBBox();
|
||||
var unscale = mainEl.data('unscale');
|
||||
handle.attr({ cx: +handle.data('ocx') + dx*unscale, cy: +handle.data('ocy') + dy*unscale });
|
||||
|
||||
|
||||
if(!mainEl.data('block_rotation')){
|
||||
var angle = Snap.angle( mainBB.cx, mainBB.cy, handle.attr('cx'), handle.attr('cy') ) - 180;
|
||||
if(event.shiftKey){
|
||||
if(event.shiftKey){ //enable block rotation
|
||||
angle = Math.round(angle/30) * 30;
|
||||
}
|
||||
}
|
||||
mainEl.data("angle", angle );
|
||||
}
|
||||
|
||||
var distance = calcDistance( mainBB.cx, mainBB.cy, handle.attr('cx'), handle.attr('cy') );
|
||||
var scale = distance / mainEl.data("scaleFactor");
|
||||
if(event.shiftKey){
|
||||
scale = Math.round(scale*4) / 4;
|
||||
}
|
||||
mainEl.data("scale", scale );
|
||||
|
||||
mainEl.ftUpdateTransform();
|
||||
mainEl.ftDrawJoinLine( handle );
|
||||
mainEl.ftDrawJoinLine( handle );
|
||||
};
|
||||
|
||||
function calcDistance(x1,y1,x2,y2) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Matrix Oven - a snapsvg.io plugin to apply & remove transformations from svg files.
|
||||
// Copyright (C) 2015 Teja Philipp <osd@tejaphilipp.de>
|
||||
//
|
||||
// based on work by https://gist.github.com/timo22345/9413158
|
||||
//
|
||||
// based on work by https://gist.github.com/timo22345/9413158
|
||||
// and https://github.com/duopixel/Method-Draw/blob/master/editor/src/svgcanvas.js
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -20,25 +20,24 @@
|
|||
|
||||
|
||||
Snap.plugin(function (Snap, Element, Paper, global) {
|
||||
|
||||
|
||||
/**
|
||||
* bakes transformations of the element and all sub-elements into coordinates
|
||||
*
|
||||
*
|
||||
* @param {boolean} toCubics : use only cubic path segments
|
||||
* @param {integer} dec : number of digits after decimal separator. defaults to 5
|
||||
* @returns {undefined}
|
||||
*/
|
||||
Element.prototype.bake = function (toCubics, dec) {
|
||||
var elem = this;
|
||||
|
||||
if (!elem || !elem.paper || elem.type !== "text" || elem.type !== "#text" || elem.type !== "tspan"){
|
||||
if (!elem || !elem.paper) // don't handle unplaced elements. this causes double handling.
|
||||
return;
|
||||
} // don't handle unplaced elements. this causes double handling.
|
||||
|
||||
if (typeof (toCubics) === 'undefined')
|
||||
toCubics = false;
|
||||
if (typeof (dec) === 'undefined')
|
||||
dec = 5;
|
||||
//var children = elem.selectAll('*')
|
||||
var children = elem.children();
|
||||
if (children.length > 0) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
|
|
@ -55,16 +54,15 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
elem.type !== "polygon" &&
|
||||
elem.type !== "polyline" &&
|
||||
elem.type !== "image" &&
|
||||
elem.type !== "path" &&
|
||||
elem.type !== "text" &&
|
||||
elem.type !== "tspan" &&
|
||||
elem.type !== "#text"){
|
||||
elem.type !== "path"){
|
||||
|
||||
// if(elem.type !== 'g' && elem.type !== 'desc' && elem.type !== 'defs')
|
||||
// console.log('skipping unsupported element ', elem.type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (elem.type == 'image' || elem.type == "text" || elem.type == "#text"){
|
||||
// TODO ...
|
||||
if (elem.type == 'image'){
|
||||
// TODO ...
|
||||
var x = parseFloat(elem.attr('x')),
|
||||
y = parseFloat(elem.attr('y')),
|
||||
w = parseFloat(elem.attr('width')),
|
||||
|
|
@ -86,11 +84,12 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var transformedY = matrix.y(x, y);
|
||||
var transformedW = matrix.x(x+w, y+h) - transformedX;
|
||||
var transformedH = matrix.y(x+w, y+h) - transformedY;
|
||||
|
||||
|
||||
elem.attr({x: transformedX, y: transformedY, width: transformedW, height: transformedH});
|
||||
return;
|
||||
}
|
||||
|
||||
//if(elem.type !== 'path') console.log("bake: converting " + elem.type + " to path");
|
||||
var path_elem = elem.convertToPath();
|
||||
|
||||
if (!path_elem || path_elem.attr('d') === '' || path_elem.attr('d') === null)
|
||||
|
|
@ -102,7 +101,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
} else {
|
||||
dec = false;
|
||||
}
|
||||
|
||||
|
||||
function r(num) {
|
||||
if (dec !== false) {
|
||||
return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
|
||||
|
|
@ -115,8 +114,8 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var d = path_elem.attr('d');
|
||||
d = (d || "").trim();
|
||||
var arr_orig;
|
||||
arr = Snap.parsePathString(d);
|
||||
if (!toCubics) {
|
||||
arr = Snap.parsePathString(d);
|
||||
if (!toCubics) {
|
||||
arr_orig = arr;
|
||||
arr = Snap.path.toAbsolute(arr);
|
||||
} else {
|
||||
|
|
@ -129,7 +128,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var matrix = transform['totalMatrix'];
|
||||
|
||||
// apply the matrix transformation on the path segments
|
||||
var j;
|
||||
var j;
|
||||
var m = arr.length;
|
||||
var letter = '';
|
||||
var letter_orig = '';
|
||||
|
|
@ -137,8 +136,8 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var y = 0;
|
||||
var new_segments = [];
|
||||
var pt = {x: 0, y: 0};
|
||||
var pt_baked = {};
|
||||
var subpath_start = {};
|
||||
var pt_baked = {};
|
||||
var subpath_start = {};
|
||||
var prevX = 0;
|
||||
var prevY = 0;
|
||||
subpath_start.x = null;
|
||||
|
|
@ -156,7 +155,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
pt.x = arr[i][6];
|
||||
pt.y = arr[i][7];
|
||||
new_segments[i] = _arc_transform(arr[i][1], arr[i][2], arr[i][3], arr[i][4], arr[i][5], pt, matrix);
|
||||
|
||||
|
||||
} else if (letter !== 'Z') {
|
||||
// parse other segs than Z and A
|
||||
for (j = 1; j < arr[i].length; j = j + 2) {
|
||||
|
|
@ -192,7 +191,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
y = subpath_start.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Convert all that was relative back to relative
|
||||
// This could be combined to above, but to make code more readable
|
||||
// this is made separately.
|
||||
|
|
@ -262,7 +261,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
//console.log("baked matrix ", matrix, " of ", path_elem.attr('id'));
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Helper to apply matrix transformations to arcs.
|
||||
* From flatten.js (https://gist.github.com/timo22345/9413158), modified a bit.
|
||||
|
|
@ -270,7 +269,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
* @param {type} a_rh : r1 of the ellipsis in degree
|
||||
* @param {type} a_rv : r2 of the ellipsis in degree
|
||||
* @param {type} a_offsetrot : x-axis rotation in degree
|
||||
* @param {type} large_arc_flag : 0 or 1
|
||||
* @param {type} large_arc_flag : 0 or 1
|
||||
* @param {int} sweep_flag : 0 or 1
|
||||
* @param {object} endpoint with properties x and y
|
||||
* @param {type} matrix : transformation matrix
|
||||
|
|
@ -312,12 +311,12 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
|
||||
// convert implicit equation to angle and halfaxis:
|
||||
// disabled intentionally
|
||||
if (false && NEARZERO(B)) { // there is a bug in this optimization: does not work for path below
|
||||
a_offsetrot = 0;
|
||||
// d="M0,350 l 50,-25
|
||||
// a25,25 -30 0,1 50,-25 l 50,-25
|
||||
// a25,50 -30 0,1 50,-25 l 50,-25
|
||||
// a25,75 -30 0,1 50,-25 l 50,-25
|
||||
if (false && NEARZERO(B)) { // there is a bug in this optimization: does not work for path below
|
||||
a_offsetrot = 0;
|
||||
// d="M0,350 l 50,-25
|
||||
// a25,25 -30 0,1 50,-25 l 50,-25
|
||||
// a25,50 -30 0,1 50,-25 l 50,-25
|
||||
// a25,75 -30 0,1 50,-25 l 50,-25
|
||||
// a25,100 -30 0,1 50,-25 l 50,-25"
|
||||
// with matrix transform="scale(0.5,2.0)"
|
||||
A2 = A;
|
||||
|
|
@ -333,7 +332,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
|
||||
// Clamp (precision issues might need this.. not likely, but better save than sorry)
|
||||
K = (K < 0) ? 0 : Math.sqrt(K);
|
||||
|
||||
|
||||
A2 = 0.5 * (A + C + K * ac);
|
||||
C2 = 0.5 * (A + C - K * ac);
|
||||
a_offsetrot = 0.5 * Math.atan2(B, ac);
|
||||
|
|
@ -354,7 +353,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
a_rh = A2;
|
||||
}
|
||||
|
||||
// If the transformation matrix contain a mirror-component
|
||||
// If the transformation matrix contain a mirror-component
|
||||
// winding order of the ellise needs to be changed.
|
||||
if ((matrix.a * matrix.d) - (matrix.b * matrix.c) < 0){
|
||||
sweep_flag = !sweep_flag ? 1 : 0;
|
||||
|
|
@ -377,30 +376,30 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var _convertToString = function (arr) {
|
||||
return arr.join(',').replace(_p2s, '$1');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Replaces an element with a path of same shape.
|
||||
* Supports rect, ellipse, circle, line, polyline, polygon and of course path
|
||||
* The element will be replaced by the path with same id.
|
||||
*
|
||||
* The element will be replaced by the path with same id.
|
||||
*
|
||||
* @returns {path}
|
||||
*/
|
||||
Element.prototype.convertToPath = function(){
|
||||
var old_element = this;
|
||||
var path = old_element.toPath();
|
||||
old_element.before(path);
|
||||
old_element.remove();
|
||||
old_element.remove();
|
||||
return path;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a path in the same shape as the origin element
|
||||
* Supports rect, ellipse, circle, line, polyline, polygon and of course path
|
||||
*
|
||||
* based on
|
||||
*
|
||||
* based on
|
||||
* https://github.com/duopixel/Method-Draw/blob/master/editor/src/svgcanvas.js
|
||||
* Modifications: Timo (https://github.com/timo22345)
|
||||
*
|
||||
*
|
||||
* @returns {path} path element
|
||||
*/
|
||||
Element.prototype.toPath = function () {
|
||||
|
|
@ -431,7 +430,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var validRadius = function (val) {
|
||||
return (isFinite(val) && (val >= 0));
|
||||
};
|
||||
|
||||
|
||||
var validCoordinate = function (val) {
|
||||
return (isFinite(val));
|
||||
};
|
||||
|
|
@ -439,19 +438,6 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
// Possibly the cubed root of 6, but 1.81 works best
|
||||
var num = 1.81;
|
||||
var tag = old_element.type;
|
||||
|
||||
var convertMMtoPixel = function (val) {
|
||||
attrList = ['rx','ry','r','cx','cy','x1','x2','y1','y2','x','y','width','height'];
|
||||
for(var attrIdx in attrList) {
|
||||
if(val.attr(attrList[attrIdx]) != null && val.attr(attrList[attrIdx]).indexOf('mm') > -1) {
|
||||
var tmp = parseFloat(val.attr(attrList[attrIdx])) * 3.5433;
|
||||
val.attr(attrList[attrIdx], tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
convertMMtoPixel(old_element);
|
||||
|
||||
switch (tag) {
|
||||
case 'ellipse':
|
||||
case 'circle':
|
||||
|
|
@ -462,13 +448,13 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
if (tag === 'circle') {
|
||||
rx = ry = +old_element.attr('r');
|
||||
}
|
||||
|
||||
|
||||
// If 'x' and 'y' are not specified, then set both to 0. // CorelDraw is creating that sometimes
|
||||
if (!validCoordinate(cx))
|
||||
cx = 0;
|
||||
if (!validCoordinate(cy))
|
||||
cy = 0;
|
||||
|
||||
|
||||
d += _convertToString([
|
||||
['M', (cx - rx), (cy)],
|
||||
['C', (cx - rx), (cy - ry / num), (cx - rx / num), (cy - ry), (cx), (cy - ry)],
|
||||
|
|
@ -495,7 +481,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
d = 'M' + old_element.attr('points') + 'Z';
|
||||
break;
|
||||
case 'rect':
|
||||
// TODO ...
|
||||
// TODO ...
|
||||
var rx = parseFloat(old_element.attr('rx')),
|
||||
ry = parseFloat(old_element.attr('ry')),
|
||||
x = parseFloat(old_element.attr('x')),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// render_fills.js - a snapsvg.io plugin to render the infill of svg files into a bitmap.
|
||||
// Copyright (C) 2015 Teja Philipp <osd@tejaphilipp.de>
|
||||
//
|
||||
// based on work by http://davidwalsh.name/convert-canvas-image
|
||||
//
|
||||
// based on work by http://davidwalsh.name/convert-canvas-image
|
||||
// and http://getcontext.net/read/svg-images-on-a-html5-canvas
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
|
||||
Snap.plugin(function (Snap, Element, Paper, global) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param {elem} elem start point
|
||||
*
|
||||
*
|
||||
* @returns {path}
|
||||
*/
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var selection = [];
|
||||
var children = elem.children();
|
||||
|
||||
|
||||
|
||||
if (children.length > 0) {
|
||||
var goRecursive = (elem.type !== "defs" && // ignore these tags
|
||||
elem.type !== "clipPath" &&
|
||||
|
|
@ -42,7 +42,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
elem.type !== "rdf:rdf" &&
|
||||
elem.type !== "cc:work" &&
|
||||
elem.type !== "sodipodi:namedview");
|
||||
|
||||
|
||||
if(goRecursive) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
|
|
@ -50,7 +50,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if(elem.type === 'image' || elem.type === "text" || elem.type === "#text"){
|
||||
if(elem.type === 'image'){
|
||||
selection.push(elem);
|
||||
} else {
|
||||
if(fillPaths && elem.is_filled()){
|
||||
|
|
@ -65,7 +65,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
|
||||
Element.prototype.is_filled = function(){
|
||||
var elem = this;
|
||||
|
||||
|
||||
// TODO text support
|
||||
// TODO opacity support
|
||||
if (elem.type !== "circle" &&
|
||||
|
|
@ -74,17 +74,14 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
elem.type !== "line" &&
|
||||
elem.type !== "polygon" &&
|
||||
elem.type !== "polyline" &&
|
||||
elem.type !== "path" //&&
|
||||
// elem.type !== "text" &&
|
||||
// elem.type !== "#text"
|
||||
){
|
||||
|
||||
elem.type !== "path" ){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var fill = elem.attr('fill');
|
||||
var opacity = elem.attr('fill-opacity');
|
||||
|
||||
|
||||
if(fill !== 'none'){
|
||||
if(opacity === null || opacity > 0){
|
||||
return true;
|
||||
|
|
@ -92,7 +89,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Element.prototype.embedImage = function(callback){
|
||||
var elem = this;
|
||||
if(elem.type !== 'image') return;
|
||||
|
|
@ -116,15 +113,15 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
};
|
||||
|
||||
image.src = url;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Element.prototype.renderPNG = function (wMM, hMM, pxPerMM, callback) {
|
||||
var elem = this;
|
||||
|
||||
// get svg as dataUrl
|
||||
var svgStr = elem.outerSVG();
|
||||
var svgDataUri = 'data:image/svg+xml;base64,' + window.btoa(unescape(encodeURIComponent(svgStr))); //deprecated unescape needed!
|
||||
var svgDataUri = 'data:image/svg+xml;base64,' + window.btoa(svgStr);
|
||||
var source = new Image();
|
||||
source.src = svgDataUri;
|
||||
|
||||
|
|
@ -132,7 +129,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
|||
var renderCanvas = document.createElement('canvas');
|
||||
renderCanvas.id = "renderCanvas";
|
||||
renderCanvas.width = wMM * pxPerMM;
|
||||
renderCanvas.height = hMM * pxPerMM;
|
||||
renderCanvas.height = hMM * pxPerMM;
|
||||
document.getElementsByTagName('body')[0].appendChild(renderCanvas);
|
||||
var renderCanvasContext = renderCanvas.getContext('2d');
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@ $(function(){
|
|||
self.clear = function(){
|
||||
snap.selectAll('#userContent>*').remove();
|
||||
snap.selectAll('#placedGcodes>*').remove();
|
||||
snap.selectAll('rect:not(#coordGrid)').remove();
|
||||
self.placedDesigns([]);
|
||||
};
|
||||
|
||||
|
|
@ -133,14 +132,13 @@ $(function(){
|
|||
};
|
||||
|
||||
self.getXYCoord = function(evt){
|
||||
if(/firefox/.test(navigator.userAgent.toLowerCase())) {
|
||||
if(isFirefox) {
|
||||
var scale = evt.target.parentElement.transform.baseVal[0].matrix.a;
|
||||
var x = self.px2mm(evt.offsetX) * scale;
|
||||
var y = self.px2mm(parseFloat(evt.target.attributes.height.value) - evt.offsetY) * scale;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
var x = self.px2mm(evt.offsetX);
|
||||
var y = self.px2mm(parseFloat(evt.target.farthestViewportElement.clientHeight) - evt.offsetY);
|
||||
var y = self.px2mm(evt.target.ownerSVGElement.getBoundingClientRect().height - evt.offsetY); // hopefully this works across browsers
|
||||
}
|
||||
x = Math.min(x, self.workingAreaWidthMM());
|
||||
y = Math.min(y, self.workingAreaHeightMM());
|
||||
|
|
@ -243,26 +241,11 @@ $(function(){
|
|||
var url = self._getSVGserveUrl(file);
|
||||
callback = function (f) {
|
||||
var newSvgAttrs = {};
|
||||
if(f.select('svg') == null){
|
||||
root_attrs = f.node.attributes;
|
||||
} else {
|
||||
var root_attrs = f.select('svg').node.attributes;
|
||||
}
|
||||
var root_attrs = f.select('svg').node.attributes;
|
||||
var doc_width = null;
|
||||
var doc_height = null;
|
||||
var doc_viewbox = null;
|
||||
|
||||
// find clippath elements
|
||||
var clipPathEl = f.selectAll('clipPath');
|
||||
if(clipPathEl.length != 0){
|
||||
console.warn("Warning: removed unsupported clipPath element in SVG");
|
||||
self.svg_contains_clipPath_warning();
|
||||
clipPathEl.remove()
|
||||
}
|
||||
|
||||
// find all elements with "display=none" and remove them
|
||||
f.selectAll("[display=none]").remove()
|
||||
|
||||
// iterate svg tag attributes
|
||||
for(var i = 0; i < root_attrs.length; i++){
|
||||
var attr = root_attrs[i];
|
||||
|
|
@ -278,19 +261,9 @@ $(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: "Illustrator SVG detected! To preserve coorect scale, please go to the \'Settings\' menu and change the \'SVG dpi\' field under \'Plugins/Svg Conversion\' according to your file. And add it again.", type: "info", hide: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// scale matrix
|
||||
var mat = self.getDocumentViewBoxMatrix(doc_width, doc_height, doc_viewbox);
|
||||
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();
|
||||
var scaleMatrixStr = new Snap.Matrix(mat[0][0],mat[0][1],mat[1][0],mat[1][1],mat[0][2],mat[1][2]).toTransformString();
|
||||
newSvgAttrs['transform'] = scaleMatrixStr;
|
||||
|
||||
var newSvg = snap.group(f.selectAll("svg>*"));
|
||||
|
|
@ -416,20 +389,8 @@ $(function(){
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
self.svg_contains_clipPath_warning = function(){
|
||||
var error = "<p>" + gettext("The SVG file contains clipPath elements.<br/>clipPath is not supported yet and has been removed from file.") + "</p>";
|
||||
//error += pnotifyAdditionalInfo("<pre>" + data.jqXHR.responseText + "</pre>");
|
||||
new PNotify({
|
||||
title: "clipPath elements removed",
|
||||
text: error,
|
||||
type: "warn",
|
||||
hide: false
|
||||
});
|
||||
};
|
||||
|
||||
self.svg_contains_text_warning = function(svg){
|
||||
var error = "<p>" + gettext("The SVG file contains text elements.<br/>If you want to laser just their outlines,<br/>please convert them to paths.<br/>Otherwise they will be engraved with infill.") + "</p>";
|
||||
var error = "<p>" + gettext("The svg file contains text elements.<br/>Please convert them to paths.<br/>Otherwise they will be ignored.") + "</p>";
|
||||
//error += pnotifyAdditionalInfo("<pre>" + data.jqXHR.responseText + "</pre>");
|
||||
new PNotify({
|
||||
title: "Text elements found",
|
||||
|
|
@ -437,6 +398,7 @@ $(function(){
|
|||
type: "warn",
|
||||
hide: false
|
||||
});
|
||||
svg.selectAll('text,tspan').remove();
|
||||
};
|
||||
|
||||
self.svg_misfitting_warning = function(svg, misfitting){
|
||||
|
|
@ -742,16 +704,6 @@ $(function(){
|
|||
return snap.selectAll("#userContent image");
|
||||
};
|
||||
|
||||
self.hasTextItems = function () {
|
||||
if(snap.selectAll("#userContent tspan").length > 0 ||
|
||||
snap.selectAll("#userContent text").length > 0 ||
|
||||
snap.selectAll("userContent #text").length > 0) {
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
};
|
||||
|
||||
self.getPlacedGcodes = ko.computed(function() {
|
||||
var gcodeFiles = [];
|
||||
ko.utils.arrayForEach(self.placedDesigns(), function(design) {
|
||||
|
|
@ -874,7 +826,7 @@ $(function(){
|
|||
for (var i = 0; i < fillings.length; i++) {
|
||||
var item = fillings[i];
|
||||
|
||||
if (item.type === 'image' || item.type === "text" || item.type === "#text") {
|
||||
if (item.type === 'image') {
|
||||
// remove filter effects on images for proper rendering
|
||||
var style = item.attr('style');
|
||||
if (style !== null) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Sets the intensity of the laser. The more intensity the deeper the effect on the material.
|
||||
Sets the intensity of the laser. The more intensity the deeper the effect on the material.
|
||||
Cutting needs higher intensities than engraving.
|
||||
The effect in general is dependent from the material and its color and surface.
|
||||
</div>
|
||||
|
|
@ -33,8 +33,8 @@
|
|||
</div>
|
||||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Sets the velocity of the laser head. The slower the movement the deeper the effect on the material.
|
||||
Cutting needs slower movement than engraving.
|
||||
Sets the velocity of the laser head. The slower the movement the deeper the effect on the material.
|
||||
Cutting needs slower movement than engraving.
|
||||
The effect in general is dependent from the material and its color and surface.
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -56,11 +56,11 @@
|
|||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Some (especially bright) materials require the laser to dwell a little until the surface has absorbed enough energy to be affected.
|
||||
This parameter sets the amount of time in milliseconds the movement is paused after the laser is switched on.
|
||||
This parameter sets the amount of time in milliseconds the movement is paused after the laser is switched on.
|
||||
If the result shows gaps in lines for example increase this value carefully. The higher the value the higher the risk of material ignition.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div data-bind="visible: show_image_parameters ">
|
||||
<p>{{ _('Image engraving parameters:') }}</p>
|
||||
<div class="control-group" >
|
||||
|
|
@ -103,10 +103,10 @@
|
|||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Pixel / raster engravings are done line by line. This sets the distance between the single lines.
|
||||
Smaller values allow finer engravings but require a more precise focus and are slower.
|
||||
Smaller values allow finer engravings but require a more precise focus and are slower.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p >{{ _('Image Preprocessing') }}</p>
|
||||
<div class="controls">
|
||||
<div class="img_preprocessing_preview before" style="background-image:url(/plugin/svgtogcode/static/img/kitty_grayscale.png);" >before</div>
|
||||
|
|
@ -114,22 +114,22 @@
|
|||
<div class="img_preprocessing_preview contrast" style="background-image:url(/plugin/svgtogcode/static/img/kitty_contrast.png);" data-bind="style: { opacity: contrastPreview }" ></div>
|
||||
<div class="img_preprocessing_preview sharpened" style="background-image:url(/plugin/svgtogcode/static/img/kitty_sharpened.png);" data-bind="style: { opacity: sharpenedPreview }" ></div>
|
||||
<div class="img_preprocessing_preview dithered" style="background-image:url(/plugin/svgtogcode/static/img/kitty_dithered_150.png);" data-bind="visible: imgDithering"></div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="photo_attribution"><a href="http://www.christianholmer.com" target="_blank">Photo: Christian Holmér</a></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div data-bind="disable:imgDithering ">
|
||||
<label class="control-label">{{ _('Contrast') }}</label>
|
||||
<div class="controls img_slider">
|
||||
<input id="svgtogcode_contrast_slider" type="text" data-bind="value: imgContrast" >
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div style="clear:both"></div>
|
||||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Increases the image contrast before converting to gcode.
|
||||
Increases the image contrast before converting to gcode.
|
||||
</div>
|
||||
|
||||
|
||||
<label class="control-label">{{ _('Sharpening') }}</label>
|
||||
<div class="controls img_slider">
|
||||
<input id="svgtogcode_sharpening_slider" class="uninitialized" type="text" data-bind="value: imgSharpening">
|
||||
|
|
@ -137,10 +137,10 @@
|
|||
<div style="clear:both"></div>
|
||||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Sharpens the image before converting to gcode.
|
||||
Sharpens the image before converting to gcode.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<label class="control-label">{{ _('Dithering') }}</label>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
|
|
@ -149,8 +149,8 @@
|
|||
</div>
|
||||
<div class="controls alert alert-info hint" data-bind="visible: showHints">
|
||||
<span class="icon icon-question-sign" aria-hidden="true"></span>
|
||||
Converts the image to solely black and white pixels.
|
||||
Use this if the laser effect on your material is not able to transfer grayscales.
|
||||
Converts the image to solely black and white pixels.
|
||||
Use this if the laser effect on your material is not able to transfer grayscales.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -185,4 +185,4 @@
|
|||
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true" data-bind="click: $root.cancel_conversion()">{{ _('Cancel') }}</a>
|
||||
<a href="#" class="btn btn-primary" data-bind="click: function() { if ($root.enableConvertButton()) { $root.convert() } }, enabled: enableConvertButton, css: {disabled: !$root.enableConvertButton()}">{{ _('Convert') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -331,7 +331,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
|||
def position(self, x, y):
|
||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||
movement_speed = min(printer_profile["axes"]["x"]["speed"], printer_profile["axes"]["y"]["speed"])
|
||||
self.commands(["G90", "G0 X%.3f Y%.3f F%d" % (x, y, movement_speed)])
|
||||
self.commands(["G90", "G0 X%.3f Y%.3f F%d" % (x, y, movement_speed), "?"])
|
||||
|
||||
def _convert_rate_value(self, factor, min=0, max=200):
|
||||
if not isinstance(factor, (int, float, long)):
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title data-bind="text: title">Mr Draw</title>
|
||||
<title data-bind="text: title">Mr Beam</title>
|
||||
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="{{ url_for('static', filename='img/apple-touch-icon-114x114.png') }}">
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="container">
|
||||
<div class="navbar-header brand" style="min-width: 272px;">
|
||||
<a class="navbar-brand" href="#">
|
||||
<img alt="Mr Draw Logo" src="{{ url_for('static', filename='img/mr-draw-red_x120.png') }}">
|
||||
<img alt="Mr Beam Logo" src="{{ url_for('static', filename='img/mr-typo-red_x120.png') }}">
|
||||
</a>
|
||||
</div>
|
||||
<!-- Navbar -->
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
<div id="control" class="accordion-inner" data-bind="visible: isReady() || isLocked() || isFlashing()">
|
||||
<div data-bind="visible: isLocked ">
|
||||
Mr Draw is in a locked state as it does not know its position.
|
||||
Mr Beam is in a locked state as it does not know its position.
|
||||
First remove any objects blocking the gantry's travel range.
|
||||
Then do a homing cycle.
|
||||
<div style='text-align: center; padding:.5em;'>
|
||||
|
|
@ -657,10 +657,12 @@
|
|||
<div class="span4">
|
||||
<ul class="focus_steps">
|
||||
<li>1. Place your material on the working area</li>
|
||||
<li>2. Move the pen over the material</li>
|
||||
<li>→ Now enable the pen calibration mode</li>
|
||||
<li>5. Adjust the pen until it touches the paper</li>
|
||||
<li>→ Disable the pen calibration mode. </li>
|
||||
<li>2. Move the laser over the material</li>
|
||||
<li>3. Put on your safety glasses</li>
|
||||
<li>4. Turn the laser safety switch to on</li>
|
||||
<li>→ Now enable the focus mode</li>
|
||||
<li>5. Adjust the focus until the laser beam is as small as possible</li>
|
||||
<li>→ Disable the focus mode. </li>
|
||||
</ul>
|
||||
<div style="text-align:center">
|
||||
<div class="btn-group" role="group" aria-label="focus mode control" style="">
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class MachineCom(object):
|
|||
self._finished_passes = 0
|
||||
|
||||
# regular expressions
|
||||
self._regex_command = re.compile("^\s*\$?([GM]\d+|[THX])")
|
||||
self._regex_command = re.compile("^\s*\$?([GM]\d+|[TH])")
|
||||
self._regex_feedrate = re.compile("F\d+", re.IGNORECASE)
|
||||
self._regex_intensity = re.compile("S\d+", re.IGNORECASE)
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ class MachineCom(object):
|
|||
elif line.startswith('['): # feedback message
|
||||
self._handle_feedback_message(line)
|
||||
elif line.startswith('Grb'): # Grbl startup message
|
||||
self._handle_startup_message(line)
|
||||
self._handle_startup_message()
|
||||
except:
|
||||
self._logger.exception("Something crashed inside the monitoring loop, please report this to Mr. Beam")
|
||||
errorMsg = "See octoprint.log for details"
|
||||
|
|
@ -405,7 +405,7 @@ class MachineCom(object):
|
|||
elif line[1:].startswith('Dis'): # [Disabled]
|
||||
pass
|
||||
|
||||
def _handle_startup_message(self, line):
|
||||
def _handle_startup_message(self):
|
||||
if self.isOperational():
|
||||
errorMsg = "Machine reset."
|
||||
self._cmd = None
|
||||
|
|
@ -420,14 +420,7 @@ class MachineCom(object):
|
|||
self._changeState(self.STATE_LOCKED)
|
||||
eventManager().fire(Events.ERROR, {"error": self.getErrorString()})
|
||||
else:
|
||||
versionMatch = re.search("Grbl (?P<grbl>.+?)(_(?P<git>[0-9a-f]{7})(?P<dirty>-dirty)?)? \[.+\]", line)
|
||||
if versionMatch:
|
||||
versionDict = versionMatch.groupdict()
|
||||
self._writeGrblVersionToFile(versionDict)
|
||||
if self._compareGrblVersion(versionDict) is False:
|
||||
self._flashGrbl()
|
||||
else:
|
||||
self._onConnected(self.STATE_LOCKED)
|
||||
self._onConnected(self.STATE_LOCKED)
|
||||
|
||||
def _update_grbl_pos(self, line):
|
||||
# line example:
|
||||
|
|
@ -618,7 +611,7 @@ class MachineCom(object):
|
|||
params = ["avrdude", "-patmega328p", "-carduino", "-b" + str(self._baudrate), "-P" + str(self._port), "-D", "-Uflash:w:" + pathToGrblHex]
|
||||
rc = subprocesscall(params)
|
||||
|
||||
if rc == 0:
|
||||
if rc is False:
|
||||
self._log("successfully flashed new grbl version")
|
||||
self._openSerial()
|
||||
self._changeState(self.STATE_CONNECTING)
|
||||
|
|
@ -755,10 +748,6 @@ class MachineCom(object):
|
|||
self._changeState(self.STATE_HOMING)
|
||||
return cmd
|
||||
|
||||
def _gcode_X_sent(self, cmd, cmd_type=None):
|
||||
self._changeState(self.STATE_HOMING) # TODO: maybe change to seperate $X mode
|
||||
return cmd
|
||||
|
||||
def _gcode_Hold_sent(self, cmd, cmd_type=None):
|
||||
self._changeState(self.STATE_PAUSED)
|
||||
return cmd
|
||||
|
|
@ -1169,9 +1158,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
|||
|
||||
if not os.path.exists(self._filename) or not os.path.isfile(self._filename):
|
||||
raise IOError("File %s does not exist" % self._filename)
|
||||
|
||||
self._stripCommments()
|
||||
|
||||
self._size = os.stat(self._filename).st_size
|
||||
self._pos = 0
|
||||
|
||||
|
|
@ -1225,16 +1211,6 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
|||
self._logger.exception("Exception while processing line")
|
||||
raise e
|
||||
|
||||
def _stripCommments(self):
|
||||
dir = os.path.dirname(os.path.abspath(self._filename))
|
||||
tmpfile = open(dir + '/gcode.tmp', 'w')
|
||||
with open(self._filename, "r") as fileobject:
|
||||
for line in fileobject:
|
||||
if process_gcode_line(line) is not None:
|
||||
tmpfile.write(line)
|
||||
tmpfile.close()
|
||||
self._filename = dir + '/gcode.tmp'
|
||||
|
||||
def convert_pause_triggers(configured_triggers):
|
||||
triggers = {
|
||||
"enable": [],
|
||||
|
|
@ -1299,7 +1275,6 @@ def serialList():
|
|||
baselist = baselist \
|
||||
+ glob.glob("/dev/ttyUSB*") \
|
||||
+ glob.glob("/dev/ttyACM*") \
|
||||
+ glob.glob("/dev/ttyAMA*") \
|
||||
+ glob.glob("/dev/tty.usb*") \
|
||||
+ glob.glob("/dev/cu.*") \
|
||||
+ glob.glob("/dev/cuaU*") \
|
||||
|
|
|
|||
Loading…
Reference in a new issue