checkpoint manual support work
This commit is contained in:
parent
373f133464
commit
ace9858018
6 changed files with 74 additions and 18 deletions
|
|
@ -663,7 +663,7 @@
|
||||||
d.setAttribute('class', 'col j-center');
|
d.setAttribute('class', 'col j-center');
|
||||||
d.onclick = function() {
|
d.onclick = function() {
|
||||||
API.selection.for_widgets(w => {
|
API.selection.for_widgets(w => {
|
||||||
current.widget[w.id] = {extruder: i};
|
API.widgets.annotate(w.id).extruder = i;
|
||||||
});
|
});
|
||||||
API.platform.update_selected();
|
API.platform.update_selected();
|
||||||
};
|
};
|
||||||
|
|
@ -1472,11 +1472,11 @@
|
||||||
sliceSupportOffset: UC.newInput(LANG.sp_offs_s, {title:LANG.sp_offs_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
|
sliceSupportOffset: UC.newInput(LANG.sp_offs_s, {title:LANG.sp_offs_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
|
||||||
sliceSupportGap: UC.newInput(LANG.sp_gaps_s, {title:LANG.sp_gaps_l, bound:UC.bound(0,5), convert:UC.toInt, modes:FDM, expert:true}),
|
sliceSupportGap: UC.newInput(LANG.sp_gaps_s, {title:LANG.sp_gaps_l, bound:UC.bound(0,5), convert:UC.toInt, modes:FDM, expert:true}),
|
||||||
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
||||||
sliceSupportSpan: UC.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, show: () => UI.sliceSupportEnable.checked}),
|
|
||||||
sliceSupportArea: UC.newInput(LANG.sp_area_s, {title:LANG.sp_area_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
|
sliceSupportArea: UC.newInput(LANG.sp_area_s, {title:LANG.sp_area_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
|
||||||
sliceSupportExtra: UC.newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, expert:true}),
|
sliceSupportExtra: UC.newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, expert:true}),
|
||||||
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
|
||||||
sliceSupportNozzle: UC.newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, modes:FDM, expert:true}, "extruders"),
|
sliceSupportNozzle: UC.newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, modes:FDM, expert:true}, "extruders"),
|
||||||
|
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
||||||
|
sliceSupportSpan: UC.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, show: () => UI.sliceSupportEnable.checked}),
|
||||||
sliceSupportEnable: UC.newBoolean(LANG.sp_auto_s, onBooleanClick, {title: LANG.sp_auto_l, modes:FDM, trigger:true}),
|
sliceSupportEnable: UC.newBoolean(LANG.sp_auto_s, onBooleanClick, {title: LANG.sp_auto_l, modes:FDM, trigger:true}),
|
||||||
|
|
||||||
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
||||||
|
|
@ -1926,7 +1926,7 @@
|
||||||
if (int && (event.ctrlKey || event.metaKey || API.feature.on_face_select)) {
|
if (int && (event.ctrlKey || event.metaKey || API.feature.on_face_select)) {
|
||||||
let q = new THREE.Quaternion();
|
let q = new THREE.Quaternion();
|
||||||
// find intersecting point, look "up" on Z and rotate to face that
|
// find intersecting point, look "up" on Z and rotate to face that
|
||||||
q.setFromUnitVectors(int.face.normal, new THREE.Vector3(0,-1,0));
|
q.setFromUnitVectors(int.face.normal, new THREE.Vector3(0,0,-1));
|
||||||
API.selection.rotate(q);
|
API.selection.rotate(q);
|
||||||
}
|
}
|
||||||
if (API.view.get() !== VIEWS.ARRANGE) {
|
if (API.view.get() !== VIEWS.ARRANGE) {
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,12 @@
|
||||||
for: forAllWidgets,
|
for: forAllWidgets,
|
||||||
load: Widget.loadFromCatalog,
|
load: Widget.loadFromCatalog,
|
||||||
meshes: meshArray,
|
meshes: meshArray,
|
||||||
opacity: setOpacity
|
opacity: setOpacity,
|
||||||
|
annotate: (id) => {
|
||||||
|
// add per widget annotation
|
||||||
|
// for things like extruder and supports
|
||||||
|
return settings.widget[id] = ( settings.widget[id] || {} );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
work: KIRI.work
|
work: KIRI.work
|
||||||
};
|
};
|
||||||
|
|
@ -1158,7 +1163,7 @@
|
||||||
}
|
}
|
||||||
forSelectedWidgets(w => {
|
forSelectedWidgets(w => {
|
||||||
w.setColor(color.selected, settings);
|
w.setColor(color.selected, settings);
|
||||||
let ext = (settings.widget[w.id] || {}).extruder || 0;
|
let ext = API.widgets.annotate(w.id).extruder || 0;
|
||||||
let b = $(`sel-ext-${ext}`);
|
let b = $(`sel-ext-${ext}`);
|
||||||
if (b) b.classList.add('pop-sel');
|
if (b) b.classList.add('pop-sel');
|
||||||
}, true);
|
}, true);
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@
|
||||||
if (groups.indexOf(this.group) < 0) {
|
if (groups.indexOf(this.group) < 0) {
|
||||||
groups.push(this.group);
|
groups.push(this.group);
|
||||||
}
|
}
|
||||||
|
// rotation stack (for undo)
|
||||||
this.roto = [];
|
this.roto = [];
|
||||||
this.mesh = null;
|
this.mesh = null;
|
||||||
this.points = null;
|
this.points = null;
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,23 @@
|
||||||
BASE = self.base,
|
BASE = self.base,
|
||||||
UTIL = BASE.util,
|
UTIL = BASE.util,
|
||||||
FDM = KIRI.driver.FDM,
|
FDM = KIRI.driver.FDM,
|
||||||
SPACE,
|
SPACE, API,
|
||||||
p1, p2, iw,
|
p1, p2, iw,
|
||||||
alert = [],
|
alert = [],
|
||||||
func = {};
|
func = {};
|
||||||
|
|
||||||
FDM.init = function(kiri, api) {
|
FDM.init = function(kiri, api) {
|
||||||
|
API = api;
|
||||||
SPACE = api.const.SPACE;
|
SPACE = api.const.SPACE;
|
||||||
|
api.event.on("mode.set", mode => {
|
||||||
|
if (mode !== 'FDM') {
|
||||||
|
clearAllWidgetSupports();
|
||||||
|
}
|
||||||
|
});
|
||||||
api.event.on("settings.load", (settings) => {
|
api.event.on("settings.load", (settings) => {
|
||||||
if (settings.mode !== 'FDM') return;
|
if (settings.mode !== 'FDM') return;
|
||||||
settings.process.outputOriginCenter = (settings.device.originCenter || false);
|
settings.process.outputOriginCenter = (settings.device.originCenter || false);
|
||||||
|
restoreSupports(api.widgets.all());
|
||||||
});
|
});
|
||||||
api.event.on("settings.saved", (settings) => {
|
api.event.on("settings.saved", (settings) => {
|
||||||
let proc = settings.process;
|
let proc = settings.process;
|
||||||
|
|
@ -48,32 +55,41 @@
|
||||||
});
|
});
|
||||||
api.event.on("fdm.supports.clear", func.sclear = () => {
|
api.event.on("fdm.supports.clear", func.sclear = () => {
|
||||||
func.sdone();
|
func.sdone();
|
||||||
|
clearAllWidgetSupports();
|
||||||
|
API.conf.save();
|
||||||
});
|
});
|
||||||
api.event.on("key.esc", () => {
|
api.event.on("key.esc", () => {
|
||||||
func.sdone()
|
func.sdone()
|
||||||
});
|
});
|
||||||
// api.event.on("mouse.hover.down", data => {
|
// api.event.on("selection.rotate", (x,y,z) => {
|
||||||
// console.log({hover_down: data.point});
|
// console.log('rotate', x,y,z);
|
||||||
// });
|
// });
|
||||||
api.event.on("mouse.hover.up", int => {
|
api.event.on("mouse.hover.up", int => {
|
||||||
console.log({hover_up: int, p1, p2, iw});
|
|
||||||
delbox('supp');
|
delbox('supp');
|
||||||
|
if (!iw) return;
|
||||||
let hy = (p1.y + p2.y) / 2;
|
let hy = (p1.y + p2.y) / 2;
|
||||||
let dy = Math.abs(p1.y - p2.y);
|
let dh = Math.abs(p1.y - p2.y);
|
||||||
let dw = api.conf.get().process.sliceSupportSize / 2;
|
let dw = api.conf.get().process.sliceSupportSize / 2;
|
||||||
addbox({x:p1.x, z:hy, y:-p1.z}, 0x0000dd, 'supp', {
|
let ip = iw.track.pos;
|
||||||
x:dw, y:dw, z:dy
|
let wa = api.widgets.annotate(iw.id);
|
||||||
}, iw.mesh);
|
let ws = (wa.support = wa.support || []);
|
||||||
|
let x = p1.x - ip.x, y = -p1.z - ip.y, z = hy;
|
||||||
|
let id = Date.now();
|
||||||
|
ws.push({x, y, z, dw, dh, id});
|
||||||
|
addWidgetSupport(iw, {x, y, z, dw, dh, id});
|
||||||
|
API.conf.save();
|
||||||
});
|
});
|
||||||
api.event.on("mouse.hover", data => {
|
api.event.on("mouse.hover", data => {
|
||||||
const { int, type, point } = data;
|
const { int, type, point } = data;
|
||||||
if (int) {
|
if (int && type === 'widget') {
|
||||||
iw = int.object.widget || iw;
|
iw = int.object.widget || iw;
|
||||||
|
} else {
|
||||||
|
iw = null;
|
||||||
}
|
}
|
||||||
// delbox('intZ');
|
// delbox('intZ');
|
||||||
// delbox('intW');
|
// delbox('intW');
|
||||||
delbox('supp');
|
|
||||||
// addbox(point, 0xff0000, 'intZ');
|
// addbox(point, 0xff0000, 'intZ');
|
||||||
|
delbox('supp');
|
||||||
p1 = point;
|
p1 = point;
|
||||||
let dir = new THREE.Vector3(0,1,0)
|
let dir = new THREE.Vector3(0,1,0)
|
||||||
let ray = new THREE.Raycaster(point, dir);
|
let ray = new THREE.Raycaster(point, dir);
|
||||||
|
|
@ -102,6 +118,38 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restoreSupports(widgets) {
|
||||||
|
widgets.forEach(widget => {
|
||||||
|
const supports = API.widgets.annotate(widget.id).support || [];
|
||||||
|
supports.forEach(pos => {
|
||||||
|
addWidgetSupport(widget, pos);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addWidgetSupport(widget, pos) {
|
||||||
|
const { x, y, z, dw, dh, id } = pos;
|
||||||
|
const sups = widget.sups = (widget.sups || {});
|
||||||
|
// prevent duplicate restore from repeated settings load calls
|
||||||
|
if (!sups[id]) {
|
||||||
|
pos.box = addbox({x, y, z}, 0x0000dd, 'supp', { x:dw, y:dw, z:dh }, widget.mesh);
|
||||||
|
sups[id] = pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearAllWidgetSupports() {
|
||||||
|
API.widgets.all().forEach(widget => {
|
||||||
|
clearWidgetSupports(widget);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearWidgetSupports(widget) {
|
||||||
|
Object.values(widget.sups || {}).forEach(support => {
|
||||||
|
widget.mesh.remove(support.box);
|
||||||
|
});
|
||||||
|
delete API.widgets.annotate(widget.id).support;
|
||||||
|
}
|
||||||
|
|
||||||
function delbox(name, group) {
|
function delbox(name, group) {
|
||||||
const old = SPACE[`__${name}`];
|
const old = SPACE[`__${name}`];
|
||||||
if (old) {
|
if (old) {
|
||||||
|
|
@ -124,6 +172,7 @@
|
||||||
box.position.y = point.y;
|
box.position.y = point.y;
|
||||||
box.position.z = point.z;
|
box.position.z = point.z;
|
||||||
(group || SPACE.scene).add(box);
|
(group || SPACE.scene).add(box);
|
||||||
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -407,6 +407,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
FDM.prepareRender = function(levels, update, options) {
|
FDM.prepareRender = function(levels, update, options) {
|
||||||
|
levels = levels.filter(level => level.length);
|
||||||
if (levels.length === 0) {
|
if (levels.length === 0) {
|
||||||
self.worker.print.maxSpeed = 0;
|
self.worker.print.maxSpeed = 0;
|
||||||
return [];
|
return [];
|
||||||
|
|
|
||||||
|
|
@ -245,8 +245,8 @@ kiri.lang['en-us'] = {
|
||||||
sp_offs_l: "offset from part\nin millimeters",
|
sp_offs_l: "offset from part\nin millimeters",
|
||||||
sp_gaps_s: "gap layers",
|
sp_gaps_s: "gap layers",
|
||||||
sp_gaps_l: "number of layers\noffset from part",
|
sp_gaps_l: "number of layers\noffset from part",
|
||||||
sp_span_s: "max bridge",
|
sp_span_s: "max span",
|
||||||
sp_span_l: "span length that\ntriggers support\nin millimeters",
|
sp_span_l: "unsupported span that causes\na new support to be generated\nin millimeters",
|
||||||
sp_area_s: "min area",
|
sp_area_s: "min area",
|
||||||
sp_area_l: "minimum area for\na support column\nin millimeters",
|
sp_area_l: "minimum area for\na support column\nin millimeters",
|
||||||
sp_xpnd_s: "expand",
|
sp_xpnd_s: "expand",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue