checkpoint manual support work
This commit is contained in:
parent
cc23ec6efe
commit
8c438d781d
5 changed files with 80 additions and 7 deletions
2
notes.md
2
notes.md
|
|
@ -13,8 +13,6 @@
|
||||||
* continuous printing (z belt systems)
|
* continuous printing (z belt systems)
|
||||||
* laser
|
* laser
|
||||||
* drag knife support
|
* drag knife support
|
||||||
* onshape
|
|
||||||
* session token timeout bug
|
|
||||||
* all
|
* all
|
||||||
* 2d image to 3d part
|
* 2d image to 3d part
|
||||||
* circular fit/layout when no-layout to prevent collisions
|
* circular fit/layout when no-layout to prevent collisions
|
||||||
|
|
|
||||||
|
|
@ -1886,15 +1886,32 @@
|
||||||
|
|
||||||
API.platform.update_size();
|
API.platform.update_size();
|
||||||
|
|
||||||
SPACE.mouse.downSelect(function(int,event) {
|
SPACE.mouse.onHover((int, ev) => {
|
||||||
|
if (!API.feature.hover) return;
|
||||||
|
if (!int) return API.widgets.meshes();
|
||||||
|
API.event.emit('mouse.hover', {int, point: int.point, type: 'widget'});
|
||||||
|
});
|
||||||
|
|
||||||
|
SPACE.platform.onHover((int, ev) => {
|
||||||
|
if (!API.feature.hover) return;
|
||||||
|
if (int) API.event.emit('mouse.hover', {point: int, type: 'platform'});
|
||||||
|
});
|
||||||
|
|
||||||
|
SPACE.mouse.downSelect((int,event) => {
|
||||||
// lay flat with meta or ctrl clicking a selected face
|
// lay flat with meta or ctrl clicking a selected face
|
||||||
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();
|
||||||
q.setFromUnitVectors(int.face.normal, new THREE.Vector3(0,0,-1));
|
// find intersecting point, look "up" on Z and rotate to face that
|
||||||
|
q.setFromUnitVectors(int.face.normal, new THREE.Vector3(0,-1,0));
|
||||||
API.selection.rotate(q);
|
API.selection.rotate(q);
|
||||||
}
|
}
|
||||||
if (API.view.get() !== VIEWS.ARRANGE) return null;
|
if (API.view.get() !== VIEWS.ARRANGE) {
|
||||||
|
// return no selection in modes other than arrange
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
// return selected meshes for further mouse processing
|
||||||
return API.selection.meshes();
|
return API.selection.meshes();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SPACE.mouse.upSelect(function(selection, event) {
|
SPACE.mouse.upSelect(function(selection, event) {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@
|
||||||
drop_group: undefined, // optional array to group multi drop
|
drop_group: undefined, // optional array to group multi drop
|
||||||
drop_layout: true, // layout on new drop
|
drop_layout: true, // layout on new drop
|
||||||
preview: true, // allow bypassing preview generation
|
preview: true, // allow bypassing preview generation
|
||||||
|
hover: false, // when true fires mouse hover events
|
||||||
};
|
};
|
||||||
|
|
||||||
const selection = {
|
const selection = {
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@
|
||||||
let KIRI = self.kiri,
|
let KIRI = self.kiri,
|
||||||
BASE = self.base,
|
BASE = self.base,
|
||||||
UTIL = BASE.util,
|
UTIL = BASE.util,
|
||||||
FDM = KIRI.driver.FDM;
|
FDM = KIRI.driver.FDM,
|
||||||
|
SPACE;
|
||||||
|
|
||||||
FDM.init = function(kiri, api) {
|
FDM.init = function(kiri, api) {
|
||||||
|
SPACE = api.const.SPACE;
|
||||||
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);
|
||||||
|
|
@ -18,6 +20,51 @@
|
||||||
let proc = settings.process;
|
let proc = settings.process;
|
||||||
api.ui.fdmSupport.marker.style.display = proc.sliceSupportEnable ? 'flex' : 'none';
|
api.ui.fdmSupport.marker.style.display = proc.sliceSupportEnable ? 'flex' : 'none';
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
|
api.feature.hover = true;
|
||||||
|
api.event.on("mouse.hover", (data) => {
|
||||||
|
const { int, type, point } = data;
|
||||||
|
if (SPACE._int1) {
|
||||||
|
SPACE.scene.remove(SPACE._int1);
|
||||||
|
}
|
||||||
|
addbox(point, 0xff0000, 'intZ');
|
||||||
|
let dir = new THREE.Vector3(0,1,0)
|
||||||
|
let ray = new THREE.Raycaster(point, dir);
|
||||||
|
// when on object, project down on downward faces
|
||||||
|
if (int && int.face && int.face.normal.z < -0.1) {
|
||||||
|
dir.y = -1;
|
||||||
|
}
|
||||||
|
let i2 = ray.intersectObjects(api.widgets.meshes(), false);
|
||||||
|
if (i2 && i2.length > 0) {
|
||||||
|
// prevent false matches close to origin of ray
|
||||||
|
i2 = i2.filter(i => i.distance > 0.01);
|
||||||
|
// prevent single point base to top matches
|
||||||
|
if (i2.length > 1) {
|
||||||
|
i2 = i2[0].point;
|
||||||
|
addbox(i2, 0x00ff00, 'intW');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function delbox(name) {
|
||||||
|
const old = SPACE[`__${name}`];
|
||||||
|
if (old) {
|
||||||
|
SPACE.scene.remove(old);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addbox(point, color, name) {
|
||||||
|
delbox(name);
|
||||||
|
name = `__${name}`;
|
||||||
|
const box = SPACE[name] = new THREE.Mesh(
|
||||||
|
new THREE.BoxGeometry(1, 1, 1),
|
||||||
|
new THREE.MeshBasicMaterial({color})
|
||||||
|
);
|
||||||
|
box.position.x = point.x;
|
||||||
|
box.position.y = point.y;
|
||||||
|
box.position.z = point.z;
|
||||||
|
SPACE.scene.add(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -704,6 +704,7 @@
|
||||||
function onMouseMove(event) {
|
function onMouseMove(event) {
|
||||||
updateLastAction();
|
updateLastAction();
|
||||||
let int, vis;
|
let int, vis;
|
||||||
|
|
||||||
if (viewControl.enabled) {
|
if (viewControl.enabled) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let selection = mouseHover ? mouseHover() : null;
|
let selection = mouseHover ? mouseHover() : null;
|
||||||
|
|
@ -781,6 +782,15 @@
|
||||||
active: updateLastAction
|
active: updateLastAction
|
||||||
},
|
},
|
||||||
|
|
||||||
|
world: {
|
||||||
|
add: function(o) {
|
||||||
|
WORLD.add(o);
|
||||||
|
},
|
||||||
|
remove: function(o) {
|
||||||
|
WORLD.remove(o);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
platform: {
|
platform: {
|
||||||
tweenTo: tweenPlatform,
|
tweenTo: tweenPlatform,
|
||||||
setSize: setPlatformSizeUpdateGrid,
|
setSize: setPlatformSizeUpdateGrid,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue