start 3d stack for laser output

This commit is contained in:
Stewart Allen 2024-09-20 13:11:21 -04:00
commit 3eff44c277
5 changed files with 39 additions and 32 deletions

View file

@ -45,14 +45,15 @@ function polyLabel(poly, label) {
}
function sliceEmitObjects(print, slice, groups, opt = { }) {
let process = print.settings.process;
let stacked = process.ctOutStack;
let grouped = stacked || process.ctOutGroup;
let label = false && process.outputLaserLabel;
let simple = opt.simple || false;
let emit = { in: [], out: [], mark: [] };
let lastEmit = opt.lastEmit;
let zcolor = print.settings.process.ctOutZColor;
let process = print.settings.process,
marked = process.ctOutMark,
stacked = process.ctOutStack,
grouped = marked || process.ctOutGroup,
label = false && process.outputLaserLabel,
simple = opt.simple || false,
emit = { in: [], out: [], mark: [] },
lastEmit = opt.lastEmit,
zcolor = print.settings.process.ctOutZColor;
function polyOut(poly, group, type, indexed) {
if (!poly) {
@ -77,7 +78,7 @@ function sliceEmitObjects(print, slice, groups, opt = { }) {
print.PPP(poly, group, pathOpt);
// when stacking (top down widget slices), if the last layer is fully contained
// by the current layer, then it is "marked" onto the current layer in a different color
if (stacked && type === "out" && lastEmit) {
if (marked && type === "out" && lastEmit) {
for (let out of lastEmit.out) {
if (out.isInside(poly)) {
polyOut(out, group, "mark");
@ -297,9 +298,10 @@ async function prepare(widgets, settings, update) {
// emit objects from each slice into output array
let layers = [];
for (let widget of widgets) {
if (process.ctOutMerged) {
// slice stack merging
// there is not layout in this mode
if (process.ctOutStack) {
// 3d stack output, no merging or layout
} else if (process.ctOutMerged) {
// slice stack merging, no layout
// there are no inner vs outer polys
// merged/same polys "increase" color/weight
let merged = [];
@ -640,7 +642,7 @@ function exportGCode(settings, data) {
function exportSVG(settings, data, cut_color) {
let { process } = settings;
let zcolor = process.ctOutZColor ? 1 : 0;
let zstack = process.ctOutStack;
let zstack = process.ctOutMark;
let lines = [], dx = 0, dy = 0, my, z = 0;
let colors = [
"black",

View file

@ -612,6 +612,7 @@ const conf = exports({
ctOutGroup: true,
ctOutZColor: false,
ctOutLayer: false,
ctOutMark: false,
ctOutStack: false,
ctOutMerged: false,
ctOriginCenter: true,
@ -655,7 +656,7 @@ const conf = exports({
ctOutGroup: true,
ctOutZColor: false,
ctOutLayer: false,
ctOutStack: false,
ctOutMark: false,
ctOutMerged: false,
ctOriginCenter: true,
ctOriginBounds: false,
@ -698,7 +699,7 @@ const conf = exports({
ctOutGroup: true,
ctOutZColor: false,
ctOutLayer: false,
ctOutStack: false,
ctOutMark: false,
ctOutMerged: false,
ctOriginCenter: true,
ctOriginBounds: false,
@ -740,7 +741,7 @@ const conf = exports({
ctOutGroup: true,
ctOutZColor: false,
ctOutLayer: false,
ctOutStack: false,
ctOutMark: false,
ctOutMerged: false,
ctOriginCenter: false,
ctOriginBounds: true,

View file

@ -11,7 +11,7 @@ gapp.register("kiri.devices", (root, exports) => {
// extend API
Object.assign(api.show, {
showDevices
devices: showDevices
});
Object.assign(api.device, {

View file

@ -1244,27 +1244,29 @@ gapp.register("kiri.init", (root, exports) => {
(ui.faceClr = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-trash-alt"></i>'}))
], {class:"ext-buttons f-row", modes:WEDM}),
_____: newGroup(LANG.dk_menu, $('lzr-knife'), { modes:DRAG, marker:true, driven, separator }),
ctOutKnifeDepth: newInput(LANG.dk_dpth_s, {title:LANG.dk_dpth_l, convert:toFloat, bound:bound(0.0,5.0) }),
ctOutKnifePasses: newInput(LANG.dk_pass_s, {title:LANG.dk_pass_l, convert:toInt, bound:bound(0,5) }),
ctOutKnifeTip: newInput(LANG.dk_offs_s, {title:LANG.dk_offs_l, convert:toFloat, bound:bound(0.0,10.0) }),
ctOutKnifeDepth: newInput(LANG.dk_dpth_s, { title:LANG.dk_dpth_l, convert:toFloat, bound:bound(0.0,5.0) }),
ctOutKnifePasses: newInput(LANG.dk_pass_s, { title:LANG.dk_pass_l, convert:toInt, bound:bound(0,5) }),
ctOutKnifeTip: newInput(LANG.dk_offs_s, { title:LANG.dk_offs_l, convert:toFloat, bound:bound(0.0,10.0) }),
_____: newGroup(LANG.lo_menu, $('lzr-layout'), { modes:TWOD, driven, separator }),
ctOutTileSpacing: newInput(LANG.ou_spac_s, {title:LANG.ou_spac_l, convert:toInt}),
ctOutMerged: newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:TWONED}),
ctOutGroup: newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, show:() => !ui.ctOutStack.checked}),
ctOutTileSpacing: newInput(LANG.ou_spac_s, { title:LANG.ou_spac_l, convert:toInt }),
ctOutMerged: newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:TWONED, show:() => !ui.ctOutStack.checked }),
ctOutGroup: newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, show:() => !(ui.ctOutMark.checked || ui.ctOutStack.checked) }),
_____: newGroup(LANG.ou_menu, $('lzr-output'), { modes:TWOD, driven, separator, group:"lzr-output" }),
ctOutPower: newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:toInt, bound:bound(1,100), modes:TWONED}),
ctOutSpeed: newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:toInt}),
ctOutPower: newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:toInt, bound:bound(1,100), modes:TWONED }),
ctOutSpeed: newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:toInt }),
ctAdaptive: newBoolean('adaptive speed', onBooleanClick, {modes:WEDM, title:'controller determines best cutting speed based on material feedback at runtime'}),
separator: newBlank({ class:"set-sep", driven }),
ctOriginBounds: newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, show:() => !ui.ctOriginCenter.checked}),
ctOriginCenter: newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, show:() => !ui.ctOriginBounds.checked}),
ctOriginBounds: newBoolean(LANG.or_bnds_s, onBooleanClick, { title:LANG.or_bnds_l, show:() => !ui.ctOriginCenter.checked }),
ctOriginCenter: newBoolean(LANG.or_cntr_s, onBooleanClick, { title:LANG.or_cntr_l, show:() => !ui.ctOriginBounds.checked }),
separator: newBlank({ class:"set-sep", driven, modes:WEDM, show:() => ui.ctOriginBounds.checked }),
ctOriginOffX: newInput(LANG.or_offx_s, {title:LANG.or_offx_l, convert:toFloat, modes:WEDM, show:() => ui.ctOriginBounds.checked}),
ctOriginOffY: newInput(LANG.or_offy_s, {title:LANG.or_offy_l, convert:toFloat, modes:WEDM, show:() => ui.ctOriginBounds.checked}),
ctOriginOffX: newInput(LANG.or_offx_s, { title:LANG.or_offx_l, convert:toFloat, modes:WEDM, show:() => ui.ctOriginBounds.checked }),
ctOriginOffY: newInput(LANG.or_offy_s, { title:LANG.or_offy_l, convert:toFloat, modes:WEDM, show:() => ui.ctOriginBounds.checked }),
separator: newBlank({ class:"set-sep", driven, modes:TWONED }),
ctOutZColor: newBoolean(LANG.ou_layo_s, onBooleanClick, {title:LANG.ou_layo_l, modes:TWONED, show:() => { return ui.ctOutMerged.checked === false }}),
ctOutLayer: newBoolean(LANG.ou_layr_s, onBooleanClick, {title:LANG.ou_layr_l, modes:TWONED}),
ctOutStack: newBoolean(LANG.ou_lays_s, onBooleanClick, {title:LANG.ou_lays_l, modes:TWONED}),
ctOutZColor: newBoolean(LANG.ou_layo_s, onBooleanClick, { title:LANG.ou_layo_l, modes:TWONED, show:() => !ui.ctOutMerged.checked }),
ctOutLayer: newBoolean(LANG.ou_layr_s, onBooleanClick, { title:LANG.ou_layr_l, modes:TWONED, show:() => !ui.ctOutStack.checked }),
ctOutMark: newBoolean(LANG.ou_lays_s, onBooleanClick, { title:LANG.ou_lays_l, modes:TWONED, show:() => !ui.ctOutStack.checked }),
separator: newBlank({ class:"set-sep", driven, modes:[LASER] }),
ctOutStack: newBoolean(LANG.ou_stak_s, onBooleanClick, { title:LANG.ou_stak_l, modes:[LASER] }),
/** SLA SETTINGS */

View file

@ -692,6 +692,8 @@ self.kiri.lang['en-us'] = {
ou_lays_l: ["mark layers for stacking. the layer above will be output in a different color which the laser can mark with a lower power. turns on layer grouping."],
ou_drkn_s: "drag knife",
ou_drkn_l: ["enable drag knife","output in gcode","cut radii are added","to corners with","cut down passes"],
ou_stak_s: "3D stack",
ou_stak_l: ["output is a 3D stack of 2D paths rather than packing layers flat in 2D"],
// OUTPUT FDM
ou_nozl_s: "nozzle temp",