swap in manifold for jscad/modeling

This commit is contained in:
Stewart Allen 2022-10-24 11:43:43 -04:00
commit 95edfc1ea9
8 changed files with 171 additions and 56 deletions

View file

@ -372,7 +372,7 @@ function fallback(models, strict) {
const tool = {
merge(models) {
models = fallback(models);
if (models.length <= 1) {
if (models.length < 2) {
return api.log.emit('nothing to merge');
}
api.log.emit(`merging ${models.length} models`).pin();
@ -391,6 +391,9 @@ const tool = {
union(models) {
models = fallback(models);
if (models.length < 2) {
return api.log.emit('nothing to union');
}
api.log.emit(`union ${models.length} models`).pin();
worker.model_union(models.map(m => {
return { id: m.id, matrix: m.matrix }
@ -407,6 +410,9 @@ const tool = {
intersect(models) {
models = fallback(models);
if (models.length < 2) {
return api.log.emit('nothing to intersect');
}
api.log.emit(`intersect ${models.length} models`).pin();
worker.model_intersect(models.map(m => {
return { id: m.id, matrix: m.matrix }
@ -423,6 +429,9 @@ const tool = {
subtract(models) {
models = fallback(models);
if (models.length < 2) {
return api.log.emit('nothing to subtract');
}
api.log.emit(`subtract ${models.length} models`).pin();
worker.model_subtract(models.map(m => {
return { id: m.id, matrix: m.matrix, tool: m.tool() }
@ -695,9 +704,9 @@ const prefs = {
select: []
},
normals: {
length: 0.5,
color_lite: 0xff0000,
color_dark: 0x00ffff
length: 0.25,
color_lite: 0xffff00,
color_dark: 0xffff00,
},
surface: {
radians: 0.1,