fix subtract
This commit is contained in:
parent
c7298d2a9f
commit
b82c411313
4 changed files with 10 additions and 6 deletions
|
|
@ -29,7 +29,7 @@
|
|||
"connect": "^3.7.0",
|
||||
"earcut": "^2.2.3",
|
||||
"express-useragent": "^1.0.13",
|
||||
"@jscad/modeling": "^2.9.0",
|
||||
"@jscad/modeling": "^2.9.2",
|
||||
"jszip": "^3.7.1",
|
||||
"moment": "^2.24.0",
|
||||
"pixi.js": "^4.8.9",
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ const CSG = {
|
|||
},
|
||||
|
||||
toPositionArray(geom) {
|
||||
if (!geom || geom.length === 0) {
|
||||
return [].toFloat32();
|
||||
}
|
||||
const out = [];
|
||||
const poly = jscadModeling.geometries.geom3
|
||||
.toPolygons(geom)
|
||||
|
|
|
|||
|
|
@ -384,10 +384,10 @@ const tool = {
|
|||
return { id: m.id, matrix: m.matrix, tool: m.tool() }
|
||||
}))
|
||||
.then(data => {
|
||||
let group = api.group.new([new mesh.model({
|
||||
let group = api.group.new(data.map(el => new mesh.model({
|
||||
file: `subtracted`,
|
||||
mesh: data
|
||||
})]).promote();
|
||||
mesh: el
|
||||
}) )).promote();
|
||||
api.selection.set([group]);
|
||||
api.log.emit('subtract complete').unpin();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -159,9 +159,10 @@ let model = {
|
|||
.map(a => base.CSG.fromPositionArray(a));
|
||||
let subs = [];
|
||||
for (let obj of bases) {
|
||||
subs.appendAll(base.CSG.subtract(obj, ...tools));
|
||||
let sub = base.CSG.subtract(obj, ...tools);
|
||||
subs.append(base.CSG.toPositionArray(sub));
|
||||
}
|
||||
return base.CSG.toPositionArray(subs);
|
||||
return subs;
|
||||
},
|
||||
|
||||
// used to generate a list for split snapping
|
||||
|
|
|
|||
Loading…
Reference in a new issue