slicing works again. slider for jog distance. footer links open in new tab
This commit is contained in:
parent
36545f4bde
commit
c097815a15
9 changed files with 98 additions and 38 deletions
|
|
@ -9,6 +9,8 @@ import logging
|
|||
import logging.handlers
|
||||
import os
|
||||
import flask
|
||||
import socket
|
||||
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.util
|
||||
|
|
@ -247,17 +249,24 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
|
|||
|
||||
engine_settings = self._convert_to_engine(profile_path)
|
||||
|
||||
from os.path import expanduser
|
||||
homedir = expanduser("~")
|
||||
executable = homedir + "/mrbeam-inkscape-ext/mrbeam.py"
|
||||
log_path = homedir + "/.octoprint/logs/svgtogcode.log"
|
||||
|
||||
# debugging stuff. TODO remove
|
||||
hostname = socket.gethostname()
|
||||
if("Bucanero" in hostname):
|
||||
executable = homedir + "/workspace/mrbeam-inkscape-ext/mrbeam.py"
|
||||
|
||||
# executable = s.get(["svgtogcode_engine"])
|
||||
# executable = "/Users/philipp/Documents/dev/MrBeam/mrbeam-inkscape-ext/standalone.py"
|
||||
executable = "/home/pi/mrbeam-inkscape-ext/standalone.py"
|
||||
log_path = "/home/pi/svgtogcode.log"
|
||||
# log_path = "/Users/philipp/svgtogcode.log"
|
||||
|
||||
if not executable:
|
||||
return False, "Path to SVG converter is not configured "
|
||||
|
||||
dest_dir, dest_file = os.path.split(machinecode_path)
|
||||
working_dir, _ = os.path.split(executable)
|
||||
args = ['"%s"' % executable, '-f "%s"' % dest_file, '-d "%s"' % dest_dir]
|
||||
args = ['python "%s"' % executable, '-f "%s"' % dest_file, '-d "%s"' % dest_dir]
|
||||
for k, v in engine_settings.items():
|
||||
args += ['"%s=%s"' % (k, str(v))]
|
||||
args += ['--create-log=false', '"--log-filename=%s"' % log_path,'"%s"' % model_path]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
function VectorConversionViewModel(loginStateViewModel) {
|
||||
function VectorConversionViewModel(loginStateViewModel, settingsViewModel) {
|
||||
var self = this;
|
||||
|
||||
self.loginState = loginStateViewModel;
|
||||
|
|
@ -11,10 +11,10 @@ function VectorConversionViewModel(loginStateViewModel) {
|
|||
self.defaultProfile = undefined;
|
||||
|
||||
self.gcodeFilename = ko.observable();
|
||||
self.laserIntensity = ko.observable();
|
||||
self.laserSpeed = ko.observable();
|
||||
self.laserIntensity = ko.observable("800"); // TODO fetch from settings
|
||||
self.laserSpeed = ko.observable("300");
|
||||
|
||||
self.title = ko.observable();
|
||||
self.title = ko.observable(undefined);
|
||||
self.slicer = ko.observable();
|
||||
self.slicers = ko.observableArray();
|
||||
self.profile = ko.observable();
|
||||
|
|
@ -55,6 +55,7 @@ function VectorConversionViewModel(loginStateViewModel) {
|
|||
};
|
||||
|
||||
self.fromResponse = function(data) {
|
||||
console.log("convert.js", data);
|
||||
self.data = data;
|
||||
|
||||
var selectedSlicer = undefined;
|
||||
|
|
@ -154,4 +155,39 @@ function VectorConversionViewModel(loginStateViewModel) {
|
|||
self.onStartup = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self._configureIntensitySlider = function() {
|
||||
self.layerSlider = $("#svgtogcode_intensity").slider({
|
||||
id: "svgtogcode_intensity_slider",
|
||||
reversed: false,
|
||||
selection: "after",
|
||||
orientation: "horizontal",
|
||||
min: 1,
|
||||
max: 1000,
|
||||
step: 1,
|
||||
value: 500,
|
||||
enabled: true,
|
||||
formatter: function(value) { return "" + (value/10) +"%"; }
|
||||
}).on("slideStop", self.changeIntensity);
|
||||
};
|
||||
|
||||
self._configureFeedrateSlider = function() {
|
||||
self.layerSlider = $("#svgtogcode_feedrate").slider({
|
||||
id: "svgtogcode_feedrate_slider",
|
||||
reversed: false,
|
||||
selection: "after",
|
||||
orientation: "horizontal",
|
||||
min: 20,
|
||||
max: 3000,
|
||||
step: 10,
|
||||
value: 300,
|
||||
enabled: true,
|
||||
formatter: function(value) { return "" + (value) +"mm/min"; }
|
||||
}).on("slideStop", self.changeFeedrate);
|
||||
};
|
||||
|
||||
self.init = function(){
|
||||
self._configureIntensitySlider();
|
||||
self._configureFeedrateSlider();
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
function Svg2GcodeViewModel(settingsViewModel) {
|
||||
var self = this;
|
||||
|
||||
self.settings = settingsViewModel;
|
||||
|
||||
self.log = [];
|
||||
|
||||
self.command = ko.observable(undefined);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -177,15 +177,15 @@ var UI_API_KEY = "{{ uiApiKey }}";
|
|||
{% endif %}
|
||||
|
||||
<div class="clearfix"></div>
|
||||
Jog distance
|
||||
Jog distance: <span data-bind="text: jogDistanceInMM">10</span>mm
|
||||
<div class="distance">
|
||||
<!--<input type="range" min="0" max="50" value="0" step="10" onchange="" />-->
|
||||
<div class="btn-group" data-toggle="buttons-radio" id="jog_distance">
|
||||
<input type="text" id="jogDistance" />
|
||||
<!-- <div class="btn-group" data-toggle="buttons-radio" id="jog_distance">
|
||||
<button type="button" class="btn distance" data-distance="0.1" data-bind="enable: loginState.isUser()">0.1</button>
|
||||
<button type="button" class="btn distance" data-distance="1" data-bind="enable: loginState.isUser()">1</button>
|
||||
<button type="button" class="btn distance active" data-distance="10" data-bind="enable: loginState.isUser()">10</button>
|
||||
<button type="button" class="btn distance" data-distance="100" data-bind="enable: loginState.isUser()">100</button>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -425,10 +425,10 @@ var UI_API_KEY = "{{ uiApiKey }}";
|
|||
<li><small>{{ _('Version') }}: <span class="version">{{ display_version }}</span></small></li>
|
||||
</ul>
|
||||
<ul class="pull-right">
|
||||
<li><a href="http://www.mr-beam.org"><i class="icon-home"></i> {{ _('Homepage') }}</a></li>
|
||||
<li><a href="https://github.com/mrbeam/OctoPrint/"><i class="icon-download"></i> {{ _('Sourcecode') }}</a></li>
|
||||
<li><a href="https://wiki.mr-beam.org"><i class="icon-book"></i> {{ _('Documentation') }}</a></li>
|
||||
<li><a href="https://github.com/mrbeam/OctoPrint/issues"><i class="icon-flag"></i> {{ _('Bugs and Requests') }}</a></li>
|
||||
<li><a href="http://www.mr-beam.org" target="_blank"><i class="icon-home"></i> {{ _('Homepage') }}</a></li>
|
||||
<li><a href="https://github.com/mrbeam/OctoPrint/" target="_blank"><i class="icon-download"></i> {{ _('Sourcecode') }}</a></li>
|
||||
<li><a href="https://wiki.mr-beam.org" target="_blank"><i class="icon-book"></i> {{ _('Documentation') }}</a></li>
|
||||
<li><a href="https://github.com/mrbeam/OctoPrint/issues" target="_blank"><i class="icon-flag"></i> {{ _('Bugs and Requests') }}</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,14 +4,13 @@
|
|||
<h3 data-bind="text: title"></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>{{ _('Please configure which slicer and which slicing profile to use and name the GCode file to slice to
|
||||
below, or click "Cancel" if you do not wish to slice the file now.') }}</p>
|
||||
<p>{{ _('Please select your laser intensity and speed:') }}</p>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Laser intensity (1-1000)') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="text" data-bind="value: laserIntensity">
|
||||
<input id="svgtogcode_intensity" type="text" data-bind="value: laserIntensity">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -19,7 +18,7 @@
|
|||
<label class="control-label">{{ _('Speed (30 - 2000)') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="text" data-bind="value: laserSpeed">
|
||||
<input id="svgtogcode_feedrate" type="text" data-bind="value: laserSpeed">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.svgtogcode.debug_logging"> {{ _('Log the output of CuraEngine to plugin_svgtogcode_engine.log') }}
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.svgtogcode.debug_logging"> {{ _('Enable logging to plugin_svgtogcode.log') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ class Printer():
|
|||
if self._selectedFile is None:
|
||||
return
|
||||
|
||||
self._addPositionData(None)
|
||||
self._addPositionData(None, None)
|
||||
self._setCurrentZ(None)
|
||||
self._comm.startPrint()
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ $(function() {
|
|||
var controlViewModel = new ControlViewModel(loginStateViewModel, settingsViewModel, printerStateViewModel);
|
||||
var terminalViewModel = new TerminalViewModel(loginStateViewModel, settingsViewModel);
|
||||
var slicingViewModel = new SlicingViewModel(loginStateViewModel);
|
||||
var vectorConversionViewModel = new VectorConversionViewModel(loginStateViewModel);
|
||||
var vectorConversionViewModel = new VectorConversionViewModel(loginStateViewModel, settingsViewModel);
|
||||
var gcodeFilesViewModel = new GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicingViewModel, vectorConversionViewModel);
|
||||
var gcodeViewModel = new GcodeViewModel(loginStateViewModel, settingsViewModel);
|
||||
var navigationViewModel = new NavigationViewModel(loginStateViewModel, appearanceViewModel, settingsViewModel, usersViewModel);
|
||||
|
|
@ -415,7 +415,8 @@ $(function() {
|
|||
// }
|
||||
//
|
||||
// ko.applyBindings(slicingViewModel, document.getElementById("slicing_configuration_dialog"));
|
||||
// ko.applyBindings(vectorConversionViewModel, document.getElementById("dialog_vector_graphics_conversion"));
|
||||
vectorConversionViewModel.init();
|
||||
ko.applyBindings(vectorConversionViewModel, document.getElementById("dialog_vector_graphics_conversion"));
|
||||
ko.applyBindings(workingAreaViewModel, document.getElementById("area_preview"));
|
||||
|
||||
// apply bindings and signal startup
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ function ControlViewModel(loginStateViewModel, settingsViewModel, printerStateVi
|
|||
self.isLoading = ko.observable(undefined);
|
||||
|
||||
self.extrusionAmount = ko.observable(undefined);
|
||||
self.jogDistanceInMM = ko.observable(undefined)
|
||||
self.controls = ko.observableArray([]);
|
||||
|
||||
self.tools = ko.observableArray([]);
|
||||
|
|
@ -119,7 +120,8 @@ function ControlViewModel(loginStateViewModel, settingsViewModel, printerStateVi
|
|||
|
||||
self.sendJogCommand = function(axis, multiplier, distance) {
|
||||
if (typeof distance === "undefined")
|
||||
distance = $('#jog_distance button.active').data('distance');
|
||||
// distance = $('#jog_distance button.active').data('distance');
|
||||
distance = self.jogDistanceInMM();
|
||||
if (self.settings.getPrinterInvertAxis(axis)) {
|
||||
multiplier *= -1;
|
||||
}
|
||||
|
|
@ -268,5 +270,30 @@ function ControlViewModel(loginStateViewModel, settingsViewModel, printerStateVi
|
|||
|
||||
self.onStartup = function() {
|
||||
self.requestData();
|
||||
self._configureJogDistanceSlider();
|
||||
};
|
||||
|
||||
self._jogDistanceMapping = [0.1, 1, 5, 10, 50, 100];
|
||||
self._configureJogDistanceSlider = function() {
|
||||
self.layerSlider = $("#jogDistance").slider({
|
||||
id: "jogDistanceSlider",
|
||||
reversed: false,
|
||||
selection: "after",
|
||||
orientation: "horizontal",
|
||||
min: 0,
|
||||
max: self._jogDistanceMapping.length-1,
|
||||
step: 1,
|
||||
value: 3,
|
||||
enabled: true,
|
||||
formatter: function(value) { return self._jogDistanceMapping[value] +"mm"; }
|
||||
}).on("slideStop", self.updateJogDistance);
|
||||
self.updateJogDistance();
|
||||
|
||||
};
|
||||
|
||||
self.updateJogDistance = function(){
|
||||
var val = self._jogDistanceMapping[$("#jogDistance").slider('getValue')];
|
||||
self.jogDistanceInMM(val);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue