complete line type support

This commit is contained in:
Stewart Allen 2020-11-12 12:15:39 -05:00
commit ed0a831332
8 changed files with 39 additions and 32 deletions

View file

@ -584,29 +584,13 @@
favorites:{},
// map of device to last process setting (name)
devproc: {},
layers:{
layerOutline: true,
layerTrace: true,
layerFacing: true,
layerRough: true,
layerFinish: true,
layerFinishX: true,
layerFinishY: true,
layerDelta: false,
layerSolid: false,
layerSparse: true,
layerFill: true,
layerSupport: true,
layerPrint: false,
layerMoves: false
},
controller:{
view: null,
dark: false,
expert: true,
hoverPop: false,
zoomSpeed: 1.0,
thinRender: false,
lineType: "path",
reverseZoom: true,
showOrigin: false,
showRulers: false,

View file

@ -85,6 +85,14 @@
platform.update_size();
}
function lineTypeSave() {
const sel = UI.lineType.options[UI.lineType.selectedIndex];
if (sel) {
settings().controller.lineType = sel.value;
API.conf.save();
}
}
function detailSave() {
let level = UI.detail.options[UI.detail.selectedIndex];
if (level) {
@ -120,7 +128,6 @@
control.freeLayout = UI.freeLayout.checked;
control.alignTop = UI.alignTop.checked;
control.reverseZoom = UI.reverseZoom.checked;
control.thinRender = UI.thinRender.checked;
control.dark = UI.dark.checked;
control.exportOcto = UI.exportOcto.checked;
control.exportGhost = UI.exportGhost.checked;
@ -1369,10 +1376,10 @@
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}),
lprefs: UC.newGroup(LANG.op_menu, $('prefs-gen2'), {inline: true}),
thinRender: UC.newBoolean(LANG.op_thin_s, booleanSave, {title:LANG.op_thin_l, modes:FDM}),
showOrigin: UC.newBoolean(LANG.op_shor_s, booleanSave, {title:LANG.op_shor_l}),
showRulers: UC.newBoolean(LANG.op_shru_s, booleanSave, {title:LANG.op_shru_l}),
showSpeeds: UC.newBoolean(LANG.op_sped_s, speedSave, {title:LANG.op_sped_l}),
lineType: UC.newSelect(LANG.op_line_s, {title: LANG.op_line_l, action: lineTypeSave, modes:FDM}, "linetype"),
layout: UC.newGroup(LANG.lo_menu, $('prefs-lay'), {inline: true}),
alignTop: UC.newBoolean(LANG.op_alig_s, booleanSave, {title:LANG.op_alig_l}),
@ -1920,6 +1927,7 @@
UI.alignTop.checked = control.alignTop;
UI.reverseZoom.checked = control.reverseZoom;
UI.decimate.checked = control.decimate;
lineTypeSave();
detailSave();
// load script extensions

View file

@ -156,7 +156,13 @@
{ name: "good" },
{ name: "fair" },
{ name: "poor" },
],
linetype: [
{ name: "path" },
{ name: "flat" },
{ name: "line" }
]
};
const tweak = {
@ -1447,7 +1453,6 @@
function updateFields() {
updateFieldsFromSettings(settings.device);
updateFieldsFromSettings(settings.process);
updateFieldsFromSettings(settings.layers);
updateFieldsFromSettings(settings.controller);
updateExtruderFields(settings.device);
}
@ -1490,7 +1495,6 @@
}
updateSettingsFromFields(settings.device);
updateSettingsFromFields(settings.process);
updateSettingsFromFields(settings.layers);
let device = settings.device;
if (device.extruders && device.extruders[device.internal]) {
updateSettingsFromFields(device.extruders[device.internal]);

View file

@ -129,7 +129,7 @@
const output = scope.output = [ seq ];
function G0G1(moving, line) {
function G0G1(g0, line) {
const mov = {};
line.forEach(function(tok) {
if (abs) {
@ -157,6 +157,8 @@
factor * pos.Z + off.Z + xoff.Z + dz
);
const moving = g0 || (fdm && pos.E <= 0);
// always add moves to the current sequence
if (moving) {
addOutput(seq, point, false, pos.F, tool);
@ -218,7 +220,7 @@
G0G1(true, line);
break;
case 'G1':
G0G1(fdm ? pos.E <= 0 : false, line);
G0G1(false, line);
break;
case 'M6':
break;

View file

@ -180,14 +180,14 @@ KIRI.worker = {
const print = current.print = KIRI.newPrint(settings, Object.values(cache));
const tools = settings.device.extruders;
const mode = settings.mode;
const thin = settings.controller.thinRender || mode !== 'FDM';
const thin = settings.controller.lineType === 'line' || mode !== 'FDM';
const flat = settings.controller.lineType === 'flat' && mode === 'FDM';
const parsed = print.parseGCode(code, offset, progress => {
send.data({ progress: progress * 0.5 });
}, done => {
const layers = KIRI.driver.FDM.prepareRender(done.output, progress => {
send.data({ progress: 0.5 + progress * 0.5 });
}, { thin, tools, xspeed: mode === 'FDM' });
}, { thin, flat, tools });
send.done({parsed: KIRI.codec.encode(layers)});
}, { fdm : mode === 'FDM' });
},

View file

@ -42,7 +42,8 @@
slices = [],
sliceEntry,
print = self.worker.print = KIRI.newPrint(settings, widgets),
isThin = settings.controller.thinRender;
isThin = settings.controller.lineType === "line",
isFlat = settings.controller.lineType === "flat";
// TODO pick a widget with a slice on the first layer and use that nozzle
// create brim, skirt, raft if specificed in FDM mode (code shared by laser)
@ -376,7 +377,7 @@
print.output = output;
print.render = FDM.prepareRender(output, progress => {
update(0.5 + progress * 0.5);
}, { tools: device.extruders, thin: isThin });
}, { tools: device.extruders, thin: isThin, flat: isFlat });
return print.render;
};
@ -507,7 +508,7 @@
.addPolys(moves, { thin: true, z: opts.z });
Object.values(prints).forEach(array => {
array.forEach(poly => {
if (poly.appearsClosed()) {
if (flat && poly.appearsClosed()) {
poly.setClosed();
poly.points.pop();
poly.length--;

View file

@ -74,8 +74,8 @@
sliceFillAngle = spro.sliceFillAngle,
view = widget.mesh && widget.mesh.newGroup ? widget.mesh.newGroup() : null;
isFlat = false;
isThin = !isFlat && settings.controller.thinRender;
isFlat = settings.controller.lineType === "flat";
isThin = !isFlat && settings.controller.lineType === "line";
offset = nozzleSize / 2;
if (isFlat) {
@ -84,7 +84,13 @@
color.line = 1
color.opacity = 0.5;
});
};
} else {
Object.values(COLOR).forEach(color => {
color.flat = false;
color.line = 1
color.opacity = 1;
});
}
if (!(sliceHeight > 0 && sliceHeight < 100)) {
return ondone("invalid slice height");

View file

@ -137,6 +137,8 @@ kiri.lang['en-us'] = {
op_invr_l: "invert mouse wheel\nscroll zoom",
op_thin_s: "thin lines",
op_thin_l: "faster part visualization\nsacrificing visual quality",
op_line_s: "line type",
op_line_l: "line style for path rendering\nimpacts 3d performance\npath: 3d best\nflat: 2d good\nline = 1d fast",
op_unit_s: "units",
op_unit_l: "workspace units affects\nspeeds and distances",