enable more range parameters. localize

This commit is contained in:
Stewart Allen 2021-02-11 14:33:00 -05:00
commit b172e29054
5 changed files with 54 additions and 28 deletions

View file

@ -495,13 +495,12 @@
*/
PRO.slicePrintPath = function(slice, startPoint, offset, output, opt = {}) {
// console.log({slicePrintPath: slice.index, ext:slice.extruder});
let i,
preout = [],
scope = this,
settings = this.settings,
device = settings.device,
process = settings.process,
process = opt.params || settings.process,
extruder = slice.extruder || 0,
nozzleSize = device.extruders[extruder].extNozzle,
firstLayer = opt.first || false,

View file

@ -8,19 +8,14 @@
BASE = self.base,
UTIL = BASE.util,
FDM = KIRI.driver.FDM,
SPACE, API, VIEWS, PROC, UI, UC,
SPACE, API, VIEWS, LANG, PROC, UI, UC,
p1, p2, iw,
lastMode, lastView, lastPillar,
isFdmMode = false,
addingSupports = false,
alert = [],
boxes = {},
func = {},
rangeVars = {
"sliceShells": "shell count",
"sliceFillType": "fill type",
"sliceFillSparse": "fill fraction"
};
func = {};
FDM.init = function(kiri, api) {
UI = api.ui;
@ -28,8 +23,35 @@
API = api;
SPACE = api.const.SPACE;
VIEWS = api.const.VIEWS;
LANG = KIRI.lang.current;
PROC = Object.keys(kiri.conf.defaults.fdm.p);
let rangeVars = {
"sliceShells": LANG.sl_shel_s,
"sliceFillType": LANG.fi_type,
"sliceFillSparse": LANG.fi_pcnt_s,
"sliceShellOrder": LANG.sl_ordr_s,
"outputTemp": LANG.ou_nozl_s,
"outputBedTemp": LANG.ou_bedd_s,
"outputFeedrate": LANG.ou_feed_s,
"outputFinishrate": LANG.ou_fini_s,
"outputShellMult": LANG.ou_shml_s,
"outputFillMult": LANG.ou_flml_s,
"outputSparseMult": LANG.ou_spml_s,
"outputRetractDist": LANG.ad_rdst_s,
"outputRetractSpeed": LANG.outputRetractSpeed,
"outputRetractWipe": LANG.ad_wpln_s,
"outputRetractDwell": LANG.ad_rdwl_s,
"outputShortPoly": LANG.ad_spol_s,
"outputMinSpeed": LANG.ad_mins_s,
"outputCoastDist": LANG.ad_scst_s,
"sliceSupportDensity": LANG.sp_dens_s,
"sliceSupportOffset": LANG.sp_offs_s,
"sliceSolidMinArea": LANG.ad_msol_s,
"sliceLayerStart": LANG.sl_strt_s,
"zHopDistance": LANG.ad_zhop_s
};
for (let key of Object.keys(rangeVars)) {
UI[key].range = true;
}

View file

@ -14,6 +14,7 @@
// slice, // src/mode/fdm/slice.js
// prepare, // src/mode/fdm/prepare.js
// export, // src/mode/fdm/export.js
getRangeParameters,
fixExtruders
};
@ -28,6 +29,23 @@
return settings;
}
function getRangeParameters(settings, index) {
let ranges = settings.process.ranges;
if (!(ranges && ranges.length)) {
return settings.process;
}
let params = Object.clone(settings.process);
for (let range of ranges) {
if (index >= range.lo && index <= range.hi) {
for (let [key,value] of Object.entries(range.fields)) {
params[key] = value;
params._range = true;
}
}
}
return params;
}
// customer gcode post function for XYZ daVinci Mini W
self.kiri_fdm_xyz_mini_w = function(gcode, options) {
return btoa("; filename = kirimoto.gcode\n; machine = dv1MW0A000\n" + gcode);

View file

@ -10,7 +10,8 @@
POLY = BASE.polygons,
FDM = KIRI.driver.FDM,
newPoint = BASE.newPoint,
newPolygon = BASE.newPolygon;
newPolygon = BASE.newPolygon,
getRangeParameters = FDM.getRangeParameters;
/**
* DRIVER PRINT CONTRACT
@ -379,6 +380,7 @@
return a.dst - b.dst;
});
let { z, slice, offset } = order[0];
let params = getRangeParameters(settings, slice.index);
slice.prep = true;
// retract between widgets or layers (when set)
if (layerout.length && slice.widget !== lastWidget) {
@ -401,6 +403,7 @@
offset,
layerout,
{
params, // range parameters
first: slice.index === 0,
support: slice.widget.support,
onBelt: slice.onbelt,

View file

@ -24,7 +24,8 @@
support: { check: 0xaa5533, face: 0xaa5533, line: 0xaa5533, opacity: 1 }
},
PROTO = Object.clone(COLOR),
bwcomp = (1 / Math.cos(Math.PI/4));
bwcomp = (1 / Math.cos(Math.PI/4)),
getRangeParameters = FDM.getRangeParameters;
let isThin = false; // force line rendering
let isFlat = false; // force flat rendering
@ -42,23 +43,6 @@
return opt;
}
function getRangeParameters(settings, index) {
let ranges = settings.process.ranges;
if (!(ranges && ranges.length)) {
return settings.process;
}
let params = Object.clone(settings.process);
for (let range of ranges) {
if (index >= range.lo && index <= range.hi) {
for (let [key,value] of Object.entries(range.fields)) {
params[key] = value;
params._range = true;
}
}
}
return params;
}
/**
* DRIVER SLICE CONTRACT
*