extend raft to include support areas
This commit is contained in:
parent
217899470e
commit
55bc459285
3 changed files with 23 additions and 26 deletions
|
|
@ -211,6 +211,10 @@ var gs_kiri_fdm = exports;
|
||||||
widget.slices[0].tops.forEach(function(top) {
|
widget.slices[0].tops.forEach(function(top) {
|
||||||
tops.push(top.poly.clone());
|
tops.push(top.poly.clone());
|
||||||
});
|
});
|
||||||
|
// collect support polygons
|
||||||
|
widget.slices[0].supports.forEach(function(support) {
|
||||||
|
tops.push(support.clone());
|
||||||
|
});
|
||||||
// nest and offset tops
|
// nest and offset tops
|
||||||
POLY.nest(tops).forEach(function(poly) {
|
POLY.nest(tops).forEach(function(poly) {
|
||||||
poly.offset(-offset + nozzle / 2).forEach(function(brim) {
|
poly.offset(-offset + nozzle / 2).forEach(function(brim) {
|
||||||
|
|
|
||||||
43
js/kiri.js
43
js/kiri.js
|
|
@ -740,13 +740,13 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
function meshArray() {
|
function meshArray() {
|
||||||
var out = [];
|
var out = [];
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
out.push(widget.mesh);
|
out.push(widget.mesh);
|
||||||
});
|
});
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
function forWidgets(f) {
|
function forAllWidgets(f) {
|
||||||
WIDGETS.slice().forEach(function(widget) {
|
WIDGETS.slice().forEach(function(widget) {
|
||||||
f(widget);
|
f(widget);
|
||||||
});
|
});
|
||||||
|
|
@ -763,7 +763,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleWireframe(color, opacity) {
|
function toggleWireframe(color, opacity) {
|
||||||
forWidgets(function(w) { w.toggleWireframe(color, opacity) });
|
forAllWidgets(function(w) { w.toggleWireframe(color, opacity) });
|
||||||
SPACE.update();
|
SPACE.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -772,7 +772,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
if (viewMode === VIEWS.PREVIEW && currentPrint) {
|
if (viewMode === VIEWS.PREVIEW && currentPrint) {
|
||||||
max = currentPrint.getLayerCount();
|
max = currentPrint.getLayerCount();
|
||||||
} else {
|
} else {
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
if (!widget.slices) return;
|
if (!widget.slices) return;
|
||||||
max = Math.max(max, widget.slices.length);
|
max = Math.max(max, widget.slices.length);
|
||||||
});
|
});
|
||||||
|
|
@ -794,7 +794,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
function hideSlices() {
|
function hideSlices() {
|
||||||
var showing = false;
|
var showing = false;
|
||||||
setOpacity(model_opacity);
|
setOpacity(model_opacity);
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
widget.setWireframe(false);
|
widget.setWireframe(false);
|
||||||
showing = widget.hideSlices() || showing;
|
showing = widget.hideSlices() || showing;
|
||||||
});
|
});
|
||||||
|
|
@ -841,7 +841,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
showLayerRange = range;
|
showLayerRange = range;
|
||||||
showLayerValue = layer;
|
showLayerValue = layer;
|
||||||
|
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
if (print) return widget.hideSlices();
|
if (print) return widget.hideSlices();
|
||||||
|
|
||||||
slices = widget.slices;
|
slices = widget.slices;
|
||||||
|
|
@ -895,13 +895,6 @@ self.kiri.license = exports.LICENSE;
|
||||||
SPACE.update();
|
SPACE.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
function newButton(name,action) {
|
|
||||||
var b = DOC.createElement("button");
|
|
||||||
b.appendChild(DOC.createTextNode(name));
|
|
||||||
b.onclick = action;
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadGCode(gcode) {
|
function loadGCode(gcode) {
|
||||||
setViewMode(VIEWS.PREVIEW);
|
setViewMode(VIEWS.PREVIEW);
|
||||||
clearPrint();
|
clearPrint();
|
||||||
|
|
@ -942,7 +935,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
if (MODE === MODES.CAM) {
|
if (MODE === MODES.CAM) {
|
||||||
setOpacity(preview_opacity_cam);
|
setOpacity(preview_opacity_cam);
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
widget.setColor(widget_cam_preview_color);
|
widget.setColor(widget_cam_preview_color);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1324,7 +1317,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSlices() {
|
function clearSlices() {
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
widget.slices = null;
|
widget.slices = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1361,7 +1354,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
setOpacity(slicing_opacity);
|
setOpacity(slicing_opacity);
|
||||||
|
|
||||||
// for each widget, slice
|
// for each widget, slice
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
var segtimes = {},
|
var segtimes = {},
|
||||||
segNumber = 0,
|
segNumber = 0,
|
||||||
errored = false,
|
errored = false,
|
||||||
|
|
@ -1421,7 +1414,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
// on update
|
// on update
|
||||||
track[widget.id] = update;
|
track[widget.id] = update;
|
||||||
totalProgress = 0;
|
totalProgress = 0;
|
||||||
forWidgets(function(w) {
|
forAllWidgets(function(w) {
|
||||||
totalProgress += (track[w.id] || 0);
|
totalProgress += (track[w.id] || 0);
|
||||||
});
|
});
|
||||||
setProgress(totalProgress / WIDGETS.length, msg);
|
setProgress(totalProgress / WIDGETS.length, msg);
|
||||||
|
|
@ -1459,7 +1452,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOpacity(value) {
|
function setOpacity(value) {
|
||||||
forWidgets(function (w) { w.setOpacity(value) });
|
forAllWidgets(function (w) { w.setOpacity(value) });
|
||||||
UI.viewModelOpacity.value = value * 100;
|
UI.viewModelOpacity.value = value * 100;
|
||||||
SPACE.update();
|
SPACE.update();
|
||||||
}
|
}
|
||||||
|
|
@ -1506,7 +1499,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
function platformComputeMaxZ() {
|
function platformComputeMaxZ() {
|
||||||
var maxZ = 0;
|
var maxZ = 0;
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
maxZ = Math.max(maxZ, widget.mesh.getBoundingBox().max.z);
|
maxZ = Math.max(maxZ, widget.mesh.getBoundingBox().max.z);
|
||||||
});
|
});
|
||||||
SPACE.platform.setMaxZ(maxZ);
|
SPACE.platform.setMaxZ(maxZ);
|
||||||
|
|
@ -1540,7 +1533,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function platformSelectAll() {
|
function platformSelectAll() {
|
||||||
forWidgets(function(w) { widgetSelect(w, true) })
|
forAllWidgets(function(w) { widgetSelect(w, true) })
|
||||||
}
|
}
|
||||||
|
|
||||||
function widgetSelect(widget, shift) {
|
function widgetSelect(widget, shift) {
|
||||||
|
|
@ -1572,7 +1565,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
function widgetDeselect(widget) {
|
function widgetDeselect(widget) {
|
||||||
if (viewMode !== VIEWS.ARRANGE) return;
|
if (viewMode !== VIEWS.ARRANGE) return;
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
widgetDeselect(widget);
|
widgetDeselect(widget);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -1616,7 +1609,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
if (!space && !layout) return SPACE.update();
|
if (!space && !layout) return SPACE.update();
|
||||||
|
|
||||||
// check if any widget has been modified
|
// check if any widget has been modified
|
||||||
forWidgets(function(w) {
|
forAllWidgets(function(w) {
|
||||||
modified |= w.isModified();
|
modified |= w.isModified();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1789,7 +1782,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
function camUpdateWidgetZ() {
|
function camUpdateWidgetZ() {
|
||||||
var ztop = MODE === MODES.CAM ? camTopZ : 0;
|
var ztop = MODE === MODES.CAM ? camTopZ : 0;
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
widget.setTopZ(ztop);
|
widget.setTopZ(ztop);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1867,7 +1860,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
var newWidgets = [],
|
var newWidgets = [],
|
||||||
oldWidgets = js2o(SDB.getItem('ws-widgets'), []);
|
oldWidgets = js2o(SDB.getItem('ws-widgets'), []);
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
newWidgets.push(widget.id);
|
newWidgets.push(widget.id);
|
||||||
oldWidgets.remove(widget.id);
|
oldWidgets.remove(widget.id);
|
||||||
widget.saveState();
|
widget.saveState();
|
||||||
|
|
@ -1994,7 +1987,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
if (skipwidgets) return;
|
if (skipwidgets) return;
|
||||||
|
|
||||||
forWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
platformDelete(widget);
|
platformDelete(widget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
var exports = {
|
var exports = {
|
||||||
COPYRIGHT:"Copyright (C) 2014-2019 Stewart Allen <sa@grid.space> - All Rights Reserved",
|
COPYRIGHT:"Copyright (C) 2014-2019 Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||||
LICENSE:"See the license.md file included with the source distribution",
|
LICENSE:"See the license.md file included with the source distribution",
|
||||||
VERSION:"1.4.1"
|
VERSION:"1.4.2"
|
||||||
};
|
};
|
||||||
if (!module) var module = {};
|
if (!module) var module = {};
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue