work on fdm slicing

This commit is contained in:
Stewart Allen 2025-07-05 00:19:41 -04:00
commit 6e172fe40f
12 changed files with 231 additions and 252 deletions

View file

@ -1,12 +1,5 @@
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
"use strict";
// Future imports for src/kiri-run/minion.js when unwrapped from gapp.register()
// Core dependencies from root
import { base, kiri } from '../../main/gapp.js';
// Base dependencies
import { polygons } from '../../geo/base.js';

View file

@ -1,7 +1,5 @@
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
console.log('TOP OF WORKER');
import "../ext/clip2.js";
import "../ext/earcut.js";
import '../add/array.js';
@ -21,6 +19,7 @@ import { version } from '../moto/license.js';
import { Widget, newWidget } from '../kiri/widget.js';
import { CAM } from '../kiri-mode/cam/driver-be.js';
import { FDM } from '../kiri-mode/fdm/driver-be.js';
// const CAM = {};
const { time } = util;
@ -28,7 +27,8 @@ const POLY = polygons;
let debug = (self.debug === true),
drivers = {
CAM
CAM,
FDM
},
ccvalue = self.navigator ? self.navigator.hardwareConcurrency || 0 : 0,
concurrent = Math.min(4, self.Worker && ccvalue > 3 ? ccvalue - 1 : 0),
@ -45,12 +45,6 @@ let debug = (self.debug === true),
minifns = {},
miniseq = 0;
const worker = self.kiri_worker = {
current,
drivers,
version
};
// catch clipper alerts and convert to console messages
self.alert = function(o) {
console.log(o);
@ -70,7 +64,7 @@ function minhandler(msg) {
}
// for concurrent operations
const minwork = worker.minions = {
const minwork = {
get concurrent() {
return concurrent
},
@ -198,6 +192,7 @@ const minwork = worker.minions = {
points: floatP,
options
}, data => {
console.log({ data });
for (let rec of data.output) {
each(rec);
}
@ -744,7 +739,16 @@ dispatch.onmessage = self.onmessage = async function(e) {
}
};
self.kiri_worker = {
cache: wcache,
current,
drivers,
version,
minions: minwork
};
// initilize driver mode handlers
CAM.init(dispatch);
FDM.init(dispatch);
broker.publish("worker.started", { dispatch, minions: minwork });