Compare commits

...

53 commits

Author SHA1 Message Date
ceca65577c
Update mrbeam_index.jinja2 2018-06-29 01:29:29 +02:00
47cd5345e8
mr drawification 2018-06-29 01:12:06 +02:00
3a24067560
Update README.md 2018-06-29 01:04:49 +02:00
make-ing
ff8b77500b changed pull command in git-pull.py script to fix my github delete repo fuck up. 2017-01-20 11:30:05 +01:00
make-ing
39c8f7886a chrome vs. firefox bugfix... Maybe needs further check to see if it can be simplyfied. Maybe use other values etc... 2016-10-04 13:03:35 +02:00
Florian
eb5e7408a9 Merge pull request #80 from mrbeam/mrbeam-dev
July Release
2016-07-06 15:08:57 +02:00
clemniem
0e346add14 #77 fixed
dataURL needed to be encoded correctly for non latin1

- rephrasing of popup for DPI conversion (Illustrator)
2016-07-06 12:11:53 +02:00
clemniem
5a696e01fa - cleanup of code 2016-07-01 12:42:40 +02:00
clemniem
9311463cfa - remove text deleted (again)
- clippath text edited
2016-07-01 12:35:32 +02:00
Florian
b19477dcfb Merge pull request #74 from mrbeam/stable-1.2.2
bux fixing issue #67: Chrome now treats the event target attributes l…
2016-07-01 10:18:32 +02:00
Clem
75f69dd0df Merge pull request #73 from mrbeam/mrbeam-dev-textInSvg
Mrbeam dev text in svg
2016-07-01 10:10:31 +02:00
clemniem
793b009ab6 popup dialoge informing user about the handling of text elements in SVG that have been detected 2016-06-30 17:45:41 +02:00
clemniem
e366b4c805 popup shows always laser infill if text is in userContent. 2016-06-30 17:31:07 +02:00
make-ing
bcfa42a034 changed back to the correct grbl.hex file 2016-06-24 10:39:38 +02:00
clemniem
6c44d8e243 added text to infill conversion, text will be treated like an image and always engraved. 2016-06-23 16:51:50 +02:00
make-ing
24cebced83 removed the xml stuff which magically appeared a previous commit 2016-06-23 15:49:47 +02:00
clemniem
8e02a97a61 added text to infill conversion, test 2 2016-06-23 14:53:04 +02:00
clemniem
4cb819fd7b added text to infill conversion 2016-06-23 14:43:04 +02:00
clemniem
3ffdceb5af fixed conversion dialog, added second checkbox for text_fills, no real functionality added yet 2016-06-23 14:09:39 +02:00
clemniem
fffc0c4ecb excluded text from being jumped over, because it is not on the paper 2016-06-23 11:04:22 +02:00
make-ing
1966a8b68c fixed #28: select all elements with attribute "display=none" and remove them. 2016-06-21 16:20:41 +02:00
clemniem
aad5efff2d WIP show text after upload in svg.
missing:
- add warning/dialogue about text in conversion dialogue
- cleanup
2016-06-21 15:13:36 +02:00
make-ing
f486a24914 fixed the DPI settings not working Problem, and added a PNotify messsage if an Illustrator comment is detected. 2016-06-21 13:44:19 +02:00
make-ing
179d2571ee Merge remote-tracking branch 'origin/mrbeam-dev' into mrbeam-dev 2016-06-21 09:49:29 +02:00
make-ing
074140bcd0 removed "?" from position commands to avoid aditional "ok" response and mazbe problems with advanced character counting. 2016-06-21 09:49:04 +02:00
clemniem
6641390620 resolved #69
rectangles are now removed after pressing clear button
2016-06-20 11:26:08 +02:00
make-ing
12a3f092e2 fixed problem when svg elements contain mm units, by converting them to pixel with a fixed dpi of 90. 2016-06-17 14:18:44 +02:00
make-ing
25be52587e fixed problem when xml tag in svg file is missing. 2016-06-17 12:02:56 +02:00
make-ing
3bbdd702db added functionality to remove comments ahead of time to remove the progress bar bug on gcode files with embeded (base64) images. 2016-06-15 11:30:53 +02:00
make-ing
0c5804e51a added functionality to remove all clipPath elements from svg into the placeSVG function 2016-06-02 18:12:50 +02:00
make-ing
36837246fe Merge branch 'mrbeam' into mrbeam-dev 2016-06-02 15:28:11 +02:00
make-ing
2c416eafc2 added functionality to unlock the GUI when grbl is also unlocked with "$x" command 2016-06-02 14:43:20 +02:00
make-ing
16d2e18daa bux fixing issue #67: Chrome now treats the event target attributes like Firefox, so no need for distinction anymore.
(cherry picked from commit 3128ac7)
2016-05-27 18:27:13 +02:00
make-ing
3128ac7765 bux fixing issue #67: Chrome now treats the event target attributes like Firefox, so no need for distinction anymore. 2016-05-27 18:17:39 +02:00
clemniem
6ffcaabbeb bugfix #64 renamed update notification to mention mrbeam 2016-05-25 16:04:39 +02:00
make-ing
48f5b659e1 changed back last commit 2016-05-04 16:35:55 +02:00
make-ing
9e95f49461 changed to new grbl.hex file 2016-05-04 16:23:43 +02:00
make-ing
64763e8ce1 added version check again... was missing since the change to comm_acc2.py 2016-05-02 09:57:58 +02:00
make-ing
e7fcb5b228 Merge branch 'nativeserial' into mrbeam 2016-04-18 17:16:28 +02:00
make-ing
020073f3ae Merge branch 'mrbeam' into stable-1.2.2 2016-04-18 14:44:52 +02:00
make-ing
c0e4f123ff Firefox bug fixes 2016-04-18 11:35:28 +02:00
make-ing
94c673473b Merge branch 'mrbeam' into stable-1.2.2 2016-04-15 16:00:28 +02:00
make-ing
974094b907 changed "toElement" to "target" for better cross browser compatibility 2016-04-15 15:53:48 +02:00
make-ing
dc23dac20c fix for the chrome 50 changes where they removed the SVGElement.offset* attributes. 2016-04-15 15:42:04 +02:00
make-ing
ba2716f968 added the Raspberry Pi native serial port ttyAMA* to serialList function 2016-04-13 12:09:39 +02:00
make-ing
a0e685ef1c fixed reset of finished passes bug. 2016-03-21 12:45:50 +01:00
make-ing
cfacbe2610 Merge branch 'stable-1.2.2' into mrbeam-multipass
Conflicts:
	src/octoprint/static/js/app/viewmodels/printerstate.js
	src/octoprint/util/comm_acc2.py
2016-03-18 13:38:05 +01:00
make-ing
4da0c3dbe0 added number of passes reset on print start 2016-03-18 13:33:57 +01:00
make-ing
a1d9d2ea7b moved reset override slider functionality to separate method.
(cherry picked from commit e5c600e)
2016-03-18 13:28:40 +01:00
make-ing
3201053e16 added multi passes support in backend 2016-03-18 12:24:41 +01:00
make-ing
e5c600e972 moved reset override slider functionality to separate method. 2016-03-17 09:59:49 +01:00
make-ing
9c822b7e93 added multipass placeholder functions 2016-03-02 15:48:52 +01:00
Teja
73749fbb19 added multipass ui 2016-01-29 18:11:59 +01:00
21 changed files with 2176 additions and 1922 deletions

View file

@ -1,5 +1,6 @@
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.
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=foosel&url=https://github.com/foosel/OctoPrint&title=OctoPrint&language=&tags=github&category=software)

View file

@ -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"], folder, git_executable=git_executable)
returncode, stdout = _git(["pull", "origin", "stable-1.2.2"], folder, git_executable=git_executable)
if returncode != 0:
raise RuntimeError("Could not update, \"git pull\" failed with returncode %d: %s" % (returncode, stdout))
print(stdout)

View file

@ -158,7 +158,7 @@ $(function() {
text += "<small>" + gettext("Those components marked with <i class=\"icon-ok\"></i> can be updated directly.") + "</small>";
var options = {
title: gettext("Update Available"),
title: gettext("Mr Beam Update Available"),
text: text,
hide: false
};

View file

@ -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
@ -357,6 +357,8 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
converter_path = '/home/teja/workspace/mrbeam-inkscape-ext'
elif("denkbrett" in hostname):
converter_path = '/home/flo/mrbeam/git/mrbeam-inkscape-ext'
elif ("clems-Air" in hostname):
converter_path = '/Users/clem/Dropbox/mrBeam/mrbeam-inkscape-ext'
import sys
sys.path.append(converter_path)

View file

@ -1160,6 +1160,7 @@ ul.dropdown-menu li a {
#control_zaxis {
display:inline-block;
width: 80px;
margin: 1em auto 0;
}
#control_zaxis_focus {
display:inline-block;
@ -1541,7 +1542,7 @@ td.settings_printerProfiles_profiles_action a.disabled {
.nav-pills>li>a,
select,
textarea,
input,
input, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"],
input.search-query,
.uneditable-input,
.input-append .add-on:last-child,

View file

@ -102,3 +102,28 @@ svg text {
.overrideSlider span {
padding-left: .6em;
}
.repeatGcode .btn-group {
width: 145px;
}
.repeatGcode input, .repeatGcode button {
width: 33%;
}
.repeatGcode input {
margin-bottom:0;
padding-left: 0;
padding-right: 0;
text-align: center;
}
.repeatGcode>span {
padding-left: .6em;
}
.manual_position_input {
padding-top: 12px;
}
#manual_position.warning {
color: #DD0000;
}

View file

@ -41,8 +41,10 @@ $(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.fill_areas() && self.show_vector_parameters());
return (self.images_placed() || self.text_placed()
|| (self.fill_areas() && self.show_vector_parameters()));
});
self.imgIntensityWhite = ko.observable(0);
self.imgIntensityBlack = ko.observable(500);
@ -85,6 +87,7 @@ $(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()){

View file

@ -30,14 +30,15 @@ Snap.plugin(function (Snap, Element, Paper, global) {
*/
Element.prototype.bake = function (toCubics, dec) {
var elem = this;
if (!elem || !elem.paper) // don't handle unplaced elements. this causes double handling.
if (!elem || !elem.paper || elem.type !== "text" || elem.type !== "#text" || elem.type !== "tspan"){
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++) {
@ -54,14 +55,15 @@ Snap.plugin(function (Snap, Element, Paper, global) {
elem.type !== "polygon" &&
elem.type !== "polyline" &&
elem.type !== "image" &&
elem.type !== "path"){
// if(elem.type !== 'g' && elem.type !== 'desc' && elem.type !== 'defs')
// console.log('skipping unsupported element ', elem.type);
elem.type !== "path" &&
elem.type !== "text" &&
elem.type !== "tspan" &&
elem.type !== "#text"){
return;
}
if (elem.type == 'image'){
if (elem.type == 'image' || elem.type == "text" || elem.type == "#text"){
// TODO ...
var x = parseFloat(elem.attr('x')),
y = parseFloat(elem.attr('y')),
@ -89,7 +91,6 @@ Snap.plugin(function (Snap, Element, Paper, global) {
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)
@ -438,6 +439,19 @@ 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':

View file

@ -50,7 +50,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
}
}
} else {
if(elem.type === 'image'){
if(elem.type === 'image' || elem.type === "text" || elem.type === "#text"){
selection.push(elem);
} else {
if(fillPaths && elem.is_filled()){
@ -74,7 +74,10 @@ Snap.plugin(function (Snap, Element, Paper, global) {
elem.type !== "line" &&
elem.type !== "polygon" &&
elem.type !== "polyline" &&
elem.type !== "path" ){
elem.type !== "path" //&&
// elem.type !== "text" &&
// elem.type !== "#text"
){
return false;
}
@ -121,7 +124,7 @@ Snap.plugin(function (Snap, Element, Paper, global) {
// get svg as dataUrl
var svgStr = elem.outerSVG();
var svgDataUri = 'data:image/svg+xml;base64,' + window.btoa(svgStr);
var svgDataUri = 'data:image/svg+xml;base64,' + window.btoa(unescape(encodeURIComponent(svgStr))); //deprecated unescape needed!
var source = new Image();
source.src = svgDataUri;

View file

@ -1,5 +1,20 @@
$(function(){
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// At least Safari 3+: "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
function WorkingAreaViewModel(params) {
var self = this;
@ -92,6 +107,7 @@ $(function(){
self.clear = function(){
snap.selectAll('#userContent>*').remove();
snap.selectAll('#placedGcodes>*').remove();
snap.selectAll('rect:not(#coordGrid)').remove();
self.placedDesigns([]);
};
@ -102,24 +118,34 @@ $(function(){
self.availableWidth($('#workingarea div.span8').innerWidth());
};
self.move_laser = function(el){
self.move_laser = function(data, evt){
self.abortFreeTransforms();
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());
var coord = self.getXYCoord(evt);
$.ajax({
url: API_BASEURL + "printer/printhead",
type: "POST",
dataType: "json",
contentType: "application/json; charset=UTF8",
data: JSON.stringify({"command": "position", x:x, y:y})
data: JSON.stringify({"command": "position", x:coord.x, y:coord.y})
});
}
};
self.getXYCoord = function(evt){
if(/firefox/.test(navigator.userAgent.toLowerCase())) {
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
{
var x = self.px2mm(evt.offsetX);
var y = self.px2mm(parseFloat(evt.target.farthestViewportElement.clientHeight) - evt.offsetY);
}
x = Math.min(x, self.workingAreaWidthMM());
y = Math.min(y, self.workingAreaHeightMM());
return {x:x, y:y};
}
self.crosshairX = function(){
var pos = self.state.currentPos();
@ -127,7 +153,7 @@ $(function(){
};
self.crosshairY = function(){
var h = document.getElementById('area_preview').clientHeight;
var h = Snap($('#area_preview')[0]).getBBox().height;
var pos = self.state.currentPos();
return pos !== undefined ? (h - self.mm2px(pos.y) - 15) : -100; // subtract height/2;
};
@ -217,11 +243,26 @@ $(function(){
var url = self._getSVGserveUrl(file);
callback = function (f) {
var newSvgAttrs = {};
var root_attrs = f.select('svg').node.attributes;
if(f.select('svg') == null){
root_attrs = f.node.attributes;
} else {
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];
@ -237,9 +278,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: "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 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>*"));
@ -365,8 +416,20 @@ $(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/>Please convert them to paths.<br/>Otherwise they will be ignored.") + "</p>";
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>";
//error += pnotifyAdditionalInfo("<pre>" + data.jqXHR.responseText + "</pre>");
new PNotify({
title: "Text elements found",
@ -374,7 +437,6 @@ $(function(){
type: "warn",
hide: false
});
svg.selectAll('text,tspan').remove();
};
self.svg_misfitting_warning = function(svg, misfitting){
@ -680,6 +742,16 @@ $(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) {
@ -802,7 +874,7 @@ $(function(){
for (var i = 0; i < fillings.length; i++) {
var item = fillings[i];
if (item.type === 'image') {
if (item.type === 'image' || item.type === "text" || item.type === "#text") {
// remove filter effects on images for proper rendering
var style = item.attr('style');
if (style !== null) {

View file

@ -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)):
@ -433,6 +433,22 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
payload["origin"] = FileDestinations.SDCARD
eventManager().fire(Events.PRINT_FAILED, payload)
def increase_passes(self):
"""
increase the number of passes by one.
"""
if self._comm is None:
return
self._comm.increasePasses()
def degrease_passes(self):
"""
degrease the number of passes by one.
"""
if self._comm is None:
return
self._comm.degreasePasses()
def get_state_string(self):
"""
Returns a human readable string corresponding to the current communication state.

View file

@ -23,7 +23,9 @@ def controlJob():
"start": [],
"restart": [],
"pause": [],
"cancel": []
"cancel": [],
"incpasses": [],
"degpasses": []
}
command, data, response = get_json_command_from_request(request, valid_commands)
@ -48,6 +50,15 @@ def controlJob():
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409)
printer.cancel_print()
elif command == "incpasses":
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'incpasses' command cannot be performed", 409)
printer.increase_passes()
elif command == "degpasses":
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'degpasses' command cannot be performed", 409)
printer.degrease_passes()
return NO_CONTENT

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -404,6 +404,11 @@ $(function() {
self.onStartup = function () {
self.requestData();
self._configureJogDistanceSlider();
$('#manual_position').keyup(function(e) {
if (e.which === 13){ // 13 == enter
self.manualPosition();
}
});
};
self.updateRotatorWidth = function() {
@ -607,6 +612,24 @@ $(function() {
self.sendCustomCommand({type: 'command', command: "G92 X0 Y0"});
};
self.manualPosition = function(){
$('#manual_position').removeClass('warning');
var s = $('#manual_position').val();
var tmp = s.split(/[^0-9.,-\\+]+/);
if (tmp.length === 2) {
var x = parseFloat(tmp[0]);
var y = parseFloat(tmp[1]);
if(!isNaN(x) && !isNaN(y)) {
self.sendCustomCommand({type: 'command', command: "G0X"+x+"Y"+y});
$('#manual_position').val('');
} else {
$('#manual_position').addClass('warning');
}
} else {
$('#manual_position').addClass('warning');
}
};
self.jogDistanceInMM = ko.observable(undefined);
self.focus_on = function () {

View file

@ -38,6 +38,7 @@ $(function() {
self.feedrateOverride = ko.observable(100);
self.intensityOverride.extend({ rateLimit: 500 });
self.feedrateOverride.extend({ rateLimit: 500 });
self.numberOfPasses = ko.observable(1);
self.TITLE_PRINT_BUTTON_PAUSED = gettext("Restarts the print job from the beginning");
self.TITLE_PRINT_BUTTON_UNPAUSED = gettext("Starts the print job");
@ -216,7 +217,8 @@ $(function() {
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
function (e) {
if (typeof callback === 'function') {
self.onEventPrintDone();
self.resetOverrideSlider();
self.numberOfPasses(1);
callback(e);
$("#confirmation_dialog").modal("hide");
$("#confirmation_dialog .confirmation_dialog_message").html('');
@ -332,16 +334,30 @@ $(function() {
};
self.increasePasses = function(){
self.numberOfPasses(self.numberOfPasses()+1);
self._jobCommand("incpasses");
}
self.decreasePasses = function(){
var passes = Math.max(self.numberOfPasses()-1, 1);
self.numberOfPasses(passes);
self._jobCommand("degpasses");
}
self.onEventPrintDone = function(){
self.feedrateOverrideSlider.slider('setValue', 100);
self.intensityOverrideSlider.slider('setValue', 100);
self.intensityOverride(100);
self.feedrateOverride(100);
self.resetOverrideSlider();
};
self.onStartup = function() {
self._configureOverrideSliders();
};
self.resetOverrideSlider = function() {
self.feedrateOverrideSlider.slider('setValue', 100);
self.intensityOverrideSlider.slider('setValue', 100);
self.intensityOverride(100);
self.feedrateOverride(100);
};
}
OCTOPRINT_VIEWMODELS.push([

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title data-bind="text: title">Mr Beam</title>
<title data-bind="text: title">Mr Draw</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 Beam Logo" src="{{ url_for('static', filename='img/mr-typo-red_x120.png') }}">
<img alt="Mr Draw Logo" src="{{ url_for('static', filename='img/mr-draw-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 Beam is in a locked state as it does not know its position.
Mr Draw 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;'>
@ -123,6 +123,10 @@
<div class="distance">
<input type="text" id="jogDistance" />
</div>
<div class="input-append manual_position_input">
<input id="manual_position" placeholder="x.xx y.yy" onsubmit="manualPosition"/>
<button class="" data-bind="click: manualPosition">Go</button>
</div>
</div>
</div>
</div>
@ -168,6 +172,19 @@
<input id="feedrate_override_slider" type="text" data-bind="sliderValue: feedrateOverride">
<span data-bind="text:feedrateOverride()">100</span>% Feedrate
</div>
<div class="repeatGcode">
<div class="btn-group">
<button type="button" class="btn btn-default btn-number" data-bind="enable: numberOfPasses() > 1, click:decreasePasses">
<span class="icon-minus"></span>
</button>
<input type="text" class="input-mini text-right" value="1" min="1" max="10" data-bind="value:numberOfPasses()">
<button type="button" class="btn btn-default btn-number" data-bind="click:increasePasses">
<span class="icon-plus"></span>
</button>
</div>
<span>Passes</span>
</div>
</div>
<!-- {{ _('Print Time') }}: <strong data-bind="text: printTimeString"></strong><br>
@ -640,12 +657,10 @@
<div class="span4">
<ul class="focus_steps">
<li>1. Place your material on the working area</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>&RightArrow; Now enable the focus mode</li>
<li>5. Adjust the focus until the laser beam is as small as possible</li>
<li>&RightArrow; Disable the focus mode. </li>
<li>2. Move the pen over the material</li>
<li>&RightArrow; Now enable the pen calibration mode</li>
<li>5. Adjust the pen until it touches the paper</li>
<li>&RightArrow; Disable the pen calibration mode. </li>
</ul>
<div style="text-align:center">
<div class="btn-group" role="group" aria-label="focus mode control" style="">

View file

@ -568,8 +568,8 @@ msgstr ""
"aktualisiert werden."
#: src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js:131
msgid "Update Available"
msgstr "Aktualisierung verfügbar"
msgid "Mr Beam Update Available"
msgstr "Mr Beam Aktualisierung verfügbar"
#: src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js:143
msgid "Ignore"

View file

@ -84,9 +84,11 @@ class MachineCom(object):
self._actual_intensity = None
self._feedrate_dict = {}
self._intensity_dict = {}
self._passes = 1
self._finished_passes = 0
# regular expressions
self._regex_command = re.compile("^\s*\$?([GM]\d+|[TH])")
self._regex_command = re.compile("^\s*\$?([GM]\d+|[THX])")
self._regex_feedrate = re.compile("F\d+", re.IGNORECASE)
self._regex_intensity = re.compile("S\d+", re.IGNORECASE)
@ -145,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()
self._handle_startup_message(line)
except:
self._logger.exception("Something crashed inside the monitoring loop, please report this to Mr. Beam")
errorMsg = "See octoprint.log for details"
@ -164,8 +166,15 @@ class MachineCom(object):
if cmd is not None:
self.sendCommand(cmd)
self._callback.on_comm_progress()
elif len(self._acc_line_buffer) == 0:
self._set_print_finished()
else:
if self._finished_passes >= self._passes:
if len(self._acc_line_buffer) == 0:
self._set_print_finished()
self._currentFile.resetToBeginning()
cmd = self._getNext()
if cmd is not None:
self.sendCommand(cmd)
self._callback.on_comm_progress()
self._sendCommand()
self._send_event.wait(1)
@ -311,7 +320,9 @@ class MachineCom(object):
if self._finished_currentFile is False:
line = self._currentFile.getNext()
if line is None:
self._finished_currentFile = True
self._finished_passes += 1
if self._finished_passes >= self._passes:
self._finished_currentFile = True
return line
else:
return None
@ -394,7 +405,7 @@ class MachineCom(object):
elif line[1:].startswith('Dis'): # [Disabled]
pass
def _handle_startup_message(self):
def _handle_startup_message(self, line):
if self.isOperational():
errorMsg = "Machine reset."
self._cmd = None
@ -409,7 +420,14 @@ class MachineCom(object):
self._changeState(self.STATE_LOCKED)
eventManager().fire(Events.ERROR, {"error": self.getErrorString()})
else:
self._onConnected(self.STATE_LOCKED)
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)
def _update_grbl_pos(self, line):
# line example:
@ -600,7 +618,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 is False:
if rc == 0:
self._log("successfully flashed new grbl version")
self._openSerial()
self._changeState(self.STATE_CONNECTING)
@ -737,6 +755,10 @@ 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
@ -827,6 +849,8 @@ class MachineCom(object):
# reset feedrate and intesity factor in case they where changed in a previous run
self._feedrate_factor = 1
self._intensity_factor = 1
self._passes = 1
self._finished_passes = 0
try:
# ensure fan is on whatever gcode follows.
@ -897,6 +921,14 @@ class MachineCom(object):
self._send_event.set()
eventManager().fire(Events.PRINT_PAUSED, payload)
def increasePasses(self):
self._passes += 1
self._log("increased Passes to %d" % self._passes)
def degreasePasses(self):
self._passes -= 1
self._log("degrease Passes to %d" % self._passes)
def getStateString(self):
if self._state == self.STATE_NONE:
return "Offline"
@ -1137,6 +1169,9 @@ 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
@ -1159,6 +1194,12 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
pass
self._handle = None
def resetToBeginning(self):
"""
resets the file handle so you can read from the beginning again.
"""
self._handle = open(self._filename, "r")
def getNext(self):
"""
Retrieves the next line for printing.
@ -1184,6 +1225,16 @@ 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": [],
@ -1248,6 +1299,7 @@ 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*") \