add feature macros

This commit is contained in:
Stewart Allen 2022-05-08 13:41:12 -04:00
commit 7f8a9f6f75
6 changed files with 45 additions and 26 deletions

View file

@ -19,7 +19,7 @@ FDM.export = function(print, online, ondone, ondebug) {
const { danger, exportThumb } = device;
const { bedWidth, bedDepth, bedRound, bedBelt, maxHeight } = device;
const { extruders, fwRetract } = device;
const { gcodeFan, gcodeLayer, gcodeTrack, gcodePause } = device;
const { gcodeFan, gcodeLayer, gcodeTrack, gcodePause, gcodeFeature } = device;
let layers = print.output,
extras = device.extras || {},
@ -622,8 +622,12 @@ FDM.export = function(print, online, ondone, ondebug) {
// emit comment on output type chage
if (last && out.type !== last.type) {
append(`; feature ${out.type}`);
lastType = out.type;
lastType = subst.feature = out.type;
if (gcodeFeature && gcodeFeature.length) {
appendAllSub(gcodeFeature);
} else {
append(`; feature ${out.type}`);
}
}
// look for extruder change, run scripts, recalc emit factor

View file

@ -125,6 +125,7 @@ function device_from_code(code,mode) {
extrudeAbs: valueOf(set.extrude_abs, false),
spindleMax: valueOf(set.spindle_max, 0),
gcodeFan: valueOf(cmd.fan_power || code.fan_power, []),
gcodeFeature: valueOf(cmd.feature || code.feature, []),
gcodeTrack: valueOf(cmd.progress || code.progress, []),
gcodeLayer: valueOf(cmd.layer || code.layer, []),
gcodePre: valueOf(code.pre, []),
@ -276,6 +277,7 @@ const conf = exports({
gcodePost: [],
gcodeProc: "",
gcodeFan: [],
gcodeFeature: [],
gcodeTrack: [],
gcodeLayer: [],
gcodeFExt: "",

View file

@ -749,6 +749,7 @@ gapp.register("kiri.init", [], (root, exports) => {
api.event.emit('device.set', devicename);
let mode = api.mode.get(),
lmode = mode.toLowerCase(),
current = settings(),
local = isLocalDevice(devicename),
dev = current.device = conf.device_from_code(code,mode),
@ -757,6 +758,9 @@ gapp.register("kiri.init", [], (root, exports) => {
predev = current.filter[mode], // previous device selection
chgdev = predev !== devicename; // device is changing
// fill missing device fields
conf.fill_cull_once(dev, conf.defaults[lmode].d);
// first time device use, add any print profiles and set to default if present
if (code.profiles) {
for (let profile of code.profiles) {
@ -829,6 +833,7 @@ gapp.register("kiri.init", [], (root, exports) => {
ui.filamentSource,
ui.deviceZMax,
ui.gcodeFan,
ui.gcodeFeature,
ui.gcodeTrack,
ui.gcodeLayer,
ui.extFilament,
@ -1720,6 +1725,7 @@ gapp.register("kiri.init", [], (root, exports) => {
(ui.gcodeLayer = uc.newGCode(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, area:gcode})).button,
(ui.gcodeTrack = uc.newGCode(LANG.dv_prog_s, {title:LANG.dv_prog_l, modes:FDM, area:gcode})).button,
(ui.gcodeFan = uc.newGCode(LANG.dv_fanp_s, {title:LANG.dv_fanp_l, modes:FDM, area:gcode})).button,
(ui.gcodeFeature = uc.newGCode(LANG.dv_feat_s, {title:LANG.dv_feat_l, modes:FDM, area:gcode})).button,
(ui.gcodeLaserOn = uc.newGCode(LANG.dv_lzon_s, {title:LANG.dv_lzon_l, modes:LASER, area:gcode})).button,
(ui.gcodeLaserOff = uc.newGCode(LANG.dv_lzof_s, {title:LANG.dv_lzof_l, modes:LASER, area:gcode})).button,
(ui.gcodeChange = uc.newGCode(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, area:gcode})).button,

View file

@ -321,7 +321,6 @@ class Widget {
mesh.renderOrder = 1;
geometry.computeVertexNormals();
geometry.addGroup(0, Infinity, 0);
// mesh.material[0].side = THREE.DoubleSide;
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.widget = this;