rename cam variables, fix some gcode gen bugs, a slider bug, flesh out cam outline

This commit is contained in:
Stewart Allen 2020-06-27 23:28:09 -04:00
commit 23e927e0d4
9 changed files with 279 additions and 195 deletions

View file

@ -19,11 +19,23 @@
// remove fields from o(bject) that don't exist in d(efault) // remove fields from o(bject) that don't exist in d(efault)
function fill_cull_once(obj, def) { function fill_cull_once(obj, def) {
if (!obj) return; if (!obj) return;
// add missing // handle renaming
for (let k in obj) {
if (obj.hasOwnProperty(k)) {
let nam = renamed[k] || k;
if (nam !== k) {
// handle field renames
obj[nam] = obj[k];
delete obj[k];
}
}
}
// fill missing
for (let k in def) { for (let k in def) {
if (def.hasOwnProperty(k)) { if (def.hasOwnProperty(k)) {
let okv = obj[k]; let okv = obj[k];
if ((okv === undefined || okv === null)) { if ((okv === undefined || okv === null)) {
// handle fill
// console.log({fill: k}); // console.log({fill: k});
obj[k] = def[k]; obj[k] = def[k];
} }
@ -49,6 +61,9 @@
} }
function valueOf(val, dv) { function valueOf(val, dv) {
if (typeof(val) === 'string' && Array.isArray(dv)) {
val = [val];
}
return typeof(val) !== 'undefined' ? val : dv; return typeof(val) !== 'undefined' ? val : dv;
} }
@ -94,11 +109,14 @@
originCenter: valueOf(set.origin_center, false), originCenter: valueOf(set.origin_center, false),
extrudeAbs: valueOf(set.extrude_abs, false), extrudeAbs: valueOf(set.extrude_abs, false),
spindleMax: valueOf(set.spindle_max, 0), spindleMax: valueOf(set.spindle_max, 0),
gcodeFan: valueOf(cmd.fan_power, ''), gcodeFan: valueOf(cmd.fan_power, []),
gcodeTrack: valueOf(cmd.progress, ''), gcodeTrack: valueOf(cmd.progress, []),
gcodeLayer: valueOf(cmd.layer, []), gcodeLayer: valueOf(cmd.layer, []),
gcodePre: valueOf(code.pre, []), gcodePre: valueOf(code.pre, []),
gcodePost: valueOf(code.post, []), gcodePost: valueOf(code.post, []),
// post processor script of which only one exists
// for XYZ.daVinci.Mini.w triggered in kiri.export
// in the fdm driver to turn gcode into base64
gcodeProc: valueOf(code.proc, ''), gcodeProc: valueOf(code.proc, ''),
gcodePause: valueOf(code.pause, []), gcodePause: valueOf(code.pause, []),
gcodeDwell: valueOf(code.dwell, []), gcodeDwell: valueOf(code.dwell, []),
@ -174,6 +192,38 @@
return settings; return settings;
} }
// auto field renaming on import
const renamed = {
roughingTool: "camRoughTool",
roughingSpindle: "camRoughSpindle",
roughingDown: "camRoughDown",
roughingOver: "camRoughOver",
roughingSpeed: "camRoughSpeed",
roughingPlunge: "camRoughPlunge",
roughingStock: "camRoughStock",
roughingPocket: "camRoughVoid",
roughingOn: "camRoughOn",
finishingTool: "camOutlineTool",
finishingSpindle: "camOutlineSpindle",
finishingDown: "camOutlineDown",
finishingOver: "camOutlineOver",
finishingSpeed: "camOutlineSpeed",
finishingPlunge: "camOutlinePlunge",
finishingOn: "camOutlineOn",
finishingXOn: "camContourXOn",
finishingYOn: "camContourYOn",
drillTool: "camDrillTool",
drillSpindle: "camDrillSpindle",
drillDownSpeed: "camDrillDownSpeed",
drillDown: "camDrillDown",
drillDwell: "camDrillDwell",
drillLift: "camDrillLift",
drillingOn: "camDrillingOn",
camPocketOnlyRough: "camRoughPocket",
camPocketOnlyFinish: "camOutlinePocket",
outputClockwise: "camConventional"
};
let CONF = KIRI.conf = { let CONF = KIRI.conf = {
// --------------- helper functions // --------------- helper functions
normalize: normalize, normalize: normalize,
@ -208,8 +258,8 @@
gcodePost: [], gcodePost: [],
gcodePause: [], gcodePause: [],
gcodeProc: "", gcodeProc: "",
gcodeFan: "", gcodeFan: [],
gcodeTrack: "", gcodeTrack: [],
gcodeLayer: [], gcodeLayer: [],
gcodeFExt: "", gcodeFExt: "",
extruders:[{ extruders:[{
@ -348,40 +398,45 @@
processName: "default", processName: "default",
camFastFeed: 6000, camFastFeed: 6000,
camFastFeedZ: 300, camFastFeedZ: 300,
roughingTool: 1000, camRoughTool: 1000, // roughingTool
roughingSpindle: 1000, camRoughSpindle: 1000, // camRoughSpindle
roughingDown: 2, camRoughDown: 2, // roughingDown
roughingOver: 0.5, camRoughOver: 0.5, // roughingOver
roughingSpeed: 1000, camRoughSpeed: 1000, // roughingSpeed
roughingPlunge: 250, camRoughPlunge: 250, // roughingPlunge
roughingStock: 0, camRoughStock: 0, // roughingStock
roughingPocket: true, camRoughVoid: true, // roughingPocket
roughingOn: true, camRoughOn: true, // roughingOn
finishingTool: 1000, camOutlineTool: 1000, // finishingTool
finishingSpindle: 1000, camOutlineSpindle: 1000,// finishingSpindle
finishingDown: 3, camOutlineDown: 3, // finishingDown
finishingOver: 0.5, camOutlineOver: 0.5, // finishingOver
finishingAngle: 85, camOutlineSpeed: 800, // finishingSpeed
finishingSpeed: 800, camOutlinePlunge: 250, // finishingPlunge
finishingPlunge: 250, camOutlineOn: true, // finishingOn
finishingOn: true, camContourTool: 1000,
finishingXOn: true, camContourSpindle: 1000,// (new)
finishingYOn: true, camContourSpeed: 1000, // (new)
finishCurvesOnly: false, camContourAngle: 85, // finishingAngle
drillTool: 1000, camContourCurves: false,// finishCurvesOnly
drillSpindle: 1000, camContourXOn: true, // finishingXOn
drillDownSpeed: 250, camContourYOn: true, // finishingYOn
drillDown: 5, camTraceTool: 1000,
drillDwell: 250, camTraceEnable: false,
drillLift: 2, camDrillTool: 1000, // drillTool
drillingOn: false, camDrillSpindle: 1000, // drillSpindle
camDrillDownSpeed: 250, // drillDownSpeed
camDrillDown: 5, // drillDown
camDrillDwell: 250, // drillDwell
camDrillLift: 2, // drillLift
camDrillingOn: false, // drillingOn
camTabsAngle: 0, camTabsAngle: 0,
camTabsCount: 4, camTabsCount: 4,
camTabsWidth: 5, camTabsWidth: 5,
camTabsHeight: 5, camTabsHeight: 5,
camTabsOn: false, camTabsOn: false,
camPocketOnlyRough: false, camRoughPocket: false, // camPocketOnlyRough
camPocketOnlyFinish: false, camOutlinePocket: false, // camPocketOnlyFinish
camDepthFirst: true, camDepthFirst: true,
camEaseDown: false, camEaseDown: false,
camOriginTop: true, camOriginTop: true,
@ -393,7 +448,7 @@
camStockY: 0, camStockY: 0,
camStockZ: 0, camStockZ: 0,
camStockOffset: true, camStockOffset: true,
outputClockwise: false, camConventional: false, // outputClockwise
outputOriginCenter: false, outputOriginCenter: false,
outputInvertX: false, outputInvertX: false,
outputInvertY: false outputInvertY: false

View file

@ -1272,29 +1272,31 @@
], {modes:FDM, expert:true, class:"ext-buttons"}), ], {modes:FDM, expert:true, class:"ext-buttons"}),
gcode: UC.newGroup(LANG.dv_gr_gco, $('device'), {group:"dgco", inline:true, modes:GCODE}), gcode: UC.newGroup(LANG.dv_gr_gco, $('device'), {group:"dgco", inline:true, modes:GCODE}),
gcodeFan: UC.newInput(LANG.dv_fanp_s, {title:LANG.dv_fanp_l, modes:FDM, size:"40%", text:true}), gcodeFanTrack: UC.newRow([
gcodeTrack: UC.newInput(LANG.dv_prog_s, {title:LANG.dv_prog_l, modes:FDM, size:"40%", text:true}), (UI.gcodeFan = UC.newGCode(LANG.dv_fanp_s, {title:LANG.dv_fanp_l, modes:FDM, area:gcode})).button,
(UI.gcodeTrack = UC.newGCode(LANG.dv_prog_s, {title:LANG.dv_prog_l, modes:FDM, area:gcode})).button
], {modes:FDM, class:"ext-buttons row"}),
gcodeLayerPause: UC.newRow([ gcodeLayerPause: UC.newRow([
(UI.gcodeLayer = UC.newGCode(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, size:14, height: 2, area:gcode})).button, (UI.gcodeLayer = UC.newGCode(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, area:gcode})).button,
(UI.gcodePause = UC.newGCode(LANG.dv_paus_s, {title:LANG.dv_paus_l, modes:FDM, size:14, height:3, area:gcode})).button, (UI.gcodePause = UC.newGCode(LANG.dv_paus_s, {title:LANG.dv_paus_l, modes:FDM, area:gcode})).button
], {modes:FDM, class:"ext-buttons row"}), ], {modes:FDM, class:"ext-buttons row"}),
gcodeSpace: UC.newBoolean(LANG.dv_tksp_s, onBooleanClick, {title:LANG.dv_tksp_l, modes:CAM_LASER}), gcodeSpace: UC.newBoolean(LANG.dv_tksp_s, onBooleanClick, {title:LANG.dv_tksp_l, modes:CAM_LASER}),
gcodeStrip: UC.newBoolean(LANG.dv_strc_s, onBooleanClick, {title:LANG.dv_strc_l, modes:CAM}), gcodeStrip: UC.newBoolean(LANG.dv_strc_s, onBooleanClick, {title:LANG.dv_strc_l, modes:CAM}),
gcodeFExt: UC.newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LASER, size:7, text:true}), gcodeFExt: UC.newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LASER, size:7, text:true}),
gcodeLaserOnOff: UC.newRow([ gcodeLaserOnOff: UC.newRow([
(UI.gcodeLaserOn = UC.newGCode(LANG.dv_lzon_s, {title:LANG.dv_lzon_l, modes:LASER, size:14, height:3, 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, size:14, height:3, area:gcode})).button, (UI.gcodeLaserOff = UC.newGCode(LANG.dv_lzof_s, {title:LANG.dv_lzof_l, modes:LASER, area:gcode})).button,
], {modes:LASER, class:"ext-buttons row"}), ], {modes:LASER, class:"ext-buttons row"}),
gcodeCam1: UC.newRow([ gcodeCam1: UC.newRow([
(UI.gcodeChange = UC.newGCode(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, size:14, height:2, area:gcode})).button (UI.gcodeChange = UC.newGCode(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, area:gcode})).button
], {modes:CAM, class:"ext-buttons row"}), ], {modes:CAM, class:"ext-buttons row"}),
gcodeCam2: UC.newRow([ gcodeCam2: UC.newRow([
(UI.gcodeDwell = UC.newGCode(LANG.dv_dwll_s, {title:LANG.dv_dwll_l, modes:CAM, size:14, height:2, area:gcode})).button, (UI.gcodeDwell = UC.newGCode(LANG.dv_dwll_s, {title:LANG.dv_dwll_l, modes:CAM, area:gcode})).button,
(UI.gcodeSpindle = UC.newGCode(LANG.dv_sspd_s, {title:LANG.dv_sspd_l, modes:CAM, size:14, height:2, area:gcode})).button (UI.gcodeSpindle = UC.newGCode(LANG.dv_sspd_s, {title:LANG.dv_sspd_l, modes:CAM, area:gcode})).button
], {modes:CAM, class:"ext-buttons row"}), ], {modes:CAM, class:"ext-buttons row"}),
gcodeHeadFoot: UC.newRow([ gcodeHeadFoot: UC.newRow([
(UI.gcodePre = UC.newGCode(LANG.dv_head_s, {title:LANG.dv_head_l, modes:GCODE, size:14, height:3, area:gcode})).button, (UI.gcodePre = UC.newGCode(LANG.dv_head_s, {title:LANG.dv_head_l, modes:GCODE, area:gcode})).button,
(UI.gcodePost = UC.newGCode(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:GCODE, size:14, height:3, area:gcode})).button (UI.gcodePost = UC.newGCode(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:GCODE, area:gcode})).button
], {modes:GCODE, class:"ext-buttons row"}), ], {modes:GCODE, class:"ext-buttons row"}),
layout: UC.newGroup(LANG.op_menu, $('prefs-gen'), {inline: true}), layout: UC.newGroup(LANG.op_menu, $('prefs-gen'), {inline: true}),
@ -1352,48 +1354,54 @@
sliceSupportNozzle: UC.newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, modes:FDM, expert:true}, "extruders"), sliceSupportNozzle: UC.newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, modes:FDM, expert:true}, "extruders"),
sliceSupportEnable: UC.newBoolean(LANG.enable, onBooleanClick, {modes:FDM}), sliceSupportEnable: UC.newBoolean(LANG.enable, onBooleanClick, {modes:FDM}),
fdmRaft: UC.newGroup(LANG.fr_menu, null, {modes:FDM, marker:true}), fdmRaft: UC.newGroup(LANG.fr_menu, null, {modes:FDM, marker:true}),
outputRaftSpacing: UC.newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:UC.toFloat, bound:UC.bound(0.0,3.0), modes:FDM}), outputRaftSpacing: UC.newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:UC.toFloat, bound:UC.bound(0.0,3.0), modes:FDM}),
outputRaft: UC.newBoolean(LANG.enable, onBooleanClick, {title:LANG.fr_nabl_l, modes:FDM}), outputRaft: UC.newBoolean(LANG.enable, onBooleanClick, {title:LANG.fr_nabl_l, modes:FDM}),
roughing: UC.newGroup(LANG.cr_menu, null, {modes:CAM, marker:true}),
roughingTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
roughingSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
roughingOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.1,1.0), modes:CAM}),
roughingDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM}),
roughingSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
roughingPlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM}),
roughingStock: UC.newInput(LANG.cr_lsto_s, {title:LANG.cr_lsto_l, convert:UC.toFloat, modes:CAM}),
roughingPocket: UC.newBoolean(LANG.cr_clrp_s, onBooleanClick, {title:LANG.cr_clrp_l, modes:CAM}),
camPocketOnlyRough: UC.newBoolean(LANG.cc_pock_s, onBooleanClick, {title:LANG.cc_pock_l, modes:CAM}),
roughingSep: UC.newBlank({class:"pop-sep"}),
roughingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
finishing: UC.newGroup(LANG.cf_menu, null, {modes:CAM, marker:true}),
finishingTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
finishingSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
finishingOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:CAM}),
finishingDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM}),
finishingAngle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90), modes:CAM}),
finishingSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
finishingPlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM}),
camPocketOnlyFinish: UC.newBoolean(LANG.cc_pock_s, onBooleanClick, {title:LANG.cc_pock_l, modes:CAM}),
finishCurvesOnly: UC.newBoolean(LANG.cf_curv_s, onBooleanClick, {title:LANG.cf_curv_l, modes:CAM}),
finishingSep: UC.newBlank({class:"pop-sep"}),
finishingOn: UC.newBoolean(LANG.cf_watr_s, onBooleanClick, {title:LANG.cf_watr_l, modes:CAM}),
finishingXOn: UC.newBoolean(LANG.cf_linx_s, onBooleanClick, {title:LANG.cf_linx_l, modes:CAM}),
finishingYOn: UC.newBoolean(LANG.cf_liny_s, onBooleanClick, {title:LANG.cf_liny_l, modes:CAM}),
drilling: UC.newGroup(LANG.cd_menu, null, {modes:CAM, marker:true}),
drillTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
drillSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
drillDown: UC.newInput(LANG.cd_plpr_s, {title:LANG.cd_plpr_l, convert:UC.toFloat, modes:CAM}),
drillDownSpeed: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toFloat, modes:CAM}),
drillDwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_l, convert:UC.toFloat, modes:CAM}),
drillLift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, modes:CAM}),
drillingSep: UC.newBlank({class:"pop-sep"}),
drillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
camRough: UC.newGroup(LANG.cr_menu, null, {modes:CAM, marker:true}),
camRoughTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
camRoughSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
camRoughOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.1,1.0), modes:CAM}),
camRoughDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM}),
camRoughSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
camRoughPlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM}),
camRoughStock: UC.newInput(LANG.cr_lsto_s, {title:LANG.cr_lsto_l, convert:UC.toFloat, modes:CAM}),
camRoughVoid: UC.newBoolean(LANG.cr_clrp_s, onBooleanClick, {title:LANG.cr_clrp_l, modes:CAM}),
camRoughPocket: UC.newBoolean(LANG.cc_pock_s, onBooleanClick, {title:LANG.cc_pock_l, modes:CAM}),
camRoughSep: UC.newBlank({class:"pop-sep"}),
camRoughOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
camOutline: UC.newGroup(LANG.co_menu, null, {modes:CAM, marker:true}),
camOutlineTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
camOutlineSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
camOutlineOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:CAM}),
camOutlineDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM}),
camOutlineSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
camOutlinePlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM}),
camOutlinePocket: UC.newBoolean(LANG.cc_pock_s, onBooleanClick, {title:LANG.cc_pock_l, modes:CAM}),
camOutlineSep: UC.newBlank({class:"pop-sep"}),
camOutlineOn: UC.newBoolean(LANG.cf_watr_s, onBooleanClick, {title:LANG.cf_watr_l, modes:CAM}),
camContour: UC.newGroup(LANG.cn_menu, null, {modes:CAM, marker:true}),
camContourTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
camContourSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
camContourSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
camContourAngle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90), modes:CAM}),
camContourCurves: UC.newBoolean(LANG.cf_curv_s, onBooleanClick, {title:LANG.cf_curv_l, modes:CAM}),
camContourSep: UC.newBlank({class:"pop-sep"}),
camContourXOn: UC.newBoolean(LANG.cf_linx_s, onBooleanClick, {title:LANG.cf_linx_l, modes:CAM}),
camContourYOn: UC.newBoolean(LANG.cf_liny_s, onBooleanClick, {title:LANG.cf_liny_l, modes:CAM}),
// camTracing: UC.newGroup(LANG.cu_menu, null, {modes:CAM, marker:true}),
// camTraceTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
// camTracingSep: UC.newBlank({class:"pop-sep"}),
// camTraceEnable: UC.newBoolean(LANG.enable, onBooleanClick, {title:'todo', modes:CAM}),
camDrill: UC.newGroup(LANG.cd_menu, null, {modes:CAM, marker:true}),
camDrillTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
camDrillSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM}),
camDrillDown: UC.newInput(LANG.cd_plpr_s, {title:LANG.cd_plpr_l, convert:UC.toFloat, modes:CAM}),
camDrillDownSpeed: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toFloat, modes:CAM}),
camDrillDwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_l, convert:UC.toFloat, modes:CAM}),
camDrillLift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, modes:CAM}),
camDrillSep: UC.newBlank({class:"pop-sep"}),
camDrillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:true}), camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:true}),
camTabsAngle: UC.newInput(LANG.ct_angl_s, {title:LANG.ct_angl_l, convert:UC.toInt, bound:UC.bound(0,360), modes:CAM}), camTabsAngle: UC.newInput(LANG.ct_angl_s, {title:LANG.ct_angl_l, convert:UC.toInt, bound:UC.bound(0,360), modes:CAM}),
camTabsCount: UC.newInput(LANG.ct_numb_s, {title:LANG.ct_numb_l, convert:UC.toInt, bound:UC.bound(1,20), modes:CAM}), camTabsCount: UC.newInput(LANG.ct_numb_s, {title:LANG.ct_numb_l, convert:UC.toInt, bound:UC.bound(1,20), modes:CAM}),
@ -1403,7 +1411,6 @@
camTabsOn: UC.newBoolean(LANG.enable, onBooleanClick, {title:LANG.ct_nabl_l, modes:CAM}), camTabsOn: UC.newBoolean(LANG.enable, onBooleanClick, {title:LANG.ct_nabl_l, modes:CAM}),
camSep1: UC.newGroup(null, null, {modes:CAM, class:"set-sep"}), camSep1: UC.newGroup(null, null, {modes:CAM, class:"set-sep"}),
camStock: UC.newGroup(LANG.cs_menu, null, {modes:CAM}), camStock: UC.newGroup(LANG.cs_menu, null, {modes:CAM}),
camStockX: UC.newInput(LANG.cs_wdth_s, {title:LANG.cs_wdth_l, convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}), camStockX: UC.newInput(LANG.cs_wdth_s, {title:LANG.cs_wdth_l, convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
camStockY: UC.newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_l, convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}), camStockY: UC.newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_l, convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
@ -1426,7 +1433,7 @@
outputFillMult: UC.newInput(LANG.ou_flml_s, {title:LANG.ou_exml_l, convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}), outputFillMult: UC.newInput(LANG.ou_flml_s, {title:LANG.ou_exml_l, convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}),
outputSparseMult: UC.newInput(LANG.ou_spml_s, {title:LANG.ou_exml_l, convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}), outputSparseMult: UC.newInput(LANG.ou_spml_s, {title:LANG.ou_exml_l, convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}),
outputFanLayer: UC.newInput(LANG.ou_fanl_s, {title:LANG.ou_fanl_l, convert:UC.toInt, bound:UC.bound(0,100), modes:FDM, expert:true}), outputFanLayer: UC.newInput(LANG.ou_fanl_s, {title:LANG.ou_fanl_l, convert:UC.toInt, bound:UC.bound(0,100), modes:FDM, expert:true}),
outputClockwise: UC.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}), camConventional: UC.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}),
camEaseDown: UC.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}), camEaseDown: UC.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}),
camDepthFirst: UC.newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l, modes:CAM}), camDepthFirst: UC.newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l, modes:CAM}),
outputOriginBounds: UC.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}), outputOriginBounds: UC.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
@ -1744,6 +1751,12 @@
return svg; return svg;
} }
function mklbl(src) {
let lbl = DOC.createElement('label');
lbl.innerText = src;
return lbl;
}
$('mode-fdm').appendChild(mksvg(icons.fdm)); $('mode-fdm').appendChild(mksvg(icons.fdm));
$('mode-sla').appendChild(mksvg(icons.sla)); $('mode-sla').appendChild(mksvg(icons.sla));
$('mode-cam').appendChild(mksvg(icons.cnc)); $('mode-cam').appendChild(mksvg(icons.cnc));
@ -1971,8 +1984,8 @@
$('rot_x_gt').onclick = () => { API.selection.rotate( d,0,0) }; $('rot_x_gt').onclick = () => { API.selection.rotate( d,0,0) };
$('rot_y_lt').onclick = () => { API.selection.rotate(0,-d,0) }; $('rot_y_lt').onclick = () => { API.selection.rotate(0,-d,0) };
$('rot_y_gt').onclick = () => { API.selection.rotate(0, d,0) }; $('rot_y_gt').onclick = () => { API.selection.rotate(0, d,0) };
$('rot_z_lt').onclick = () => { API.selection.rotate(0,0,-d) }; $('rot_z_lt').onclick = () => { API.selection.rotate(0,0, d) };
$('rot_z_gt').onclick = () => { API.selection.rotate(0,0, d) }; $('rot_z_gt').onclick = () => { API.selection.rotate(0,0,-d) };
UI.modal.onclick = API.modal.hide; UI.modal.onclick = API.modal.hide;
UI.modalBox.onclick = (ev) => { ev.stopPropagation() }; UI.modalBox.onclick = (ev) => { ev.stopPropagation() };

View file

@ -578,6 +578,7 @@
} }
layer = bound(layer, 0, API.var.layer_max); layer = bound(layer, 0, API.var.layer_max);
if (layer < API.var.layer_lo) API.var.layer_lo = layer;
API.var.layer_hi = layer; API.var.layer_hi = layer;
API.event.emit("slider.label"); API.event.emit("slider.label");

View file

@ -372,7 +372,6 @@
let opt = options || {}, let opt = options || {},
row = lastDiv, row = lastDiv,
btn = DOC.createElement("button"), btn = DOC.createElement("button"),
pop = DOC.createElement("div"),
txt = DOC.createElement("textarea"), txt = DOC.createElement("textarea"),
area = opt.area; area = opt.area;
@ -381,6 +380,7 @@
txt.setAttribute("style", "resize: none"); txt.setAttribute("style", "resize: none");
txt.onblur = inputAction; txt.onblur = inputAction;
btn.setAttribute("class", "basis-50");
btn.appendChild(DOC.createTextNode(label)); btn.appendChild(DOC.createTextNode(label));
btn.onclick = function(ev) { btn.onclick = function(ev) {

View file

@ -23,9 +23,9 @@
}, },
CPRO = CAM.process = { CPRO = CAM.process = {
ROUGH: 1, ROUGH: 1,
FINISH: 2, OUTLINE: 2,
FINISH_X: 3, CONTOUR_X: 3,
FINISH_Y: 4, CONTOUR_Y: 4,
FACING: 5, FACING: 5,
DRILL: 6 DRILL: 6
}, },
@ -55,12 +55,11 @@
api.event.on("settings.saved", (settings) => { api.event.on("settings.saved", (settings) => {
let proc = settings.process; let proc = settings.process;
api.ui.camTabs.marker.style.display = proc.camTabsOn ? 'flex' : 'none'; api.ui.camTabs.marker.style.display = proc.camTabsOn ? 'flex' : 'none';
api.ui.roughing.marker.style.display = proc.roughingOn ? 'flex' : 'none'; api.ui.camRough.marker.style.display = proc.camRoughOn ? 'flex' : 'none';
api.ui.drilling.marker.style.display = proc.drillingOn ? 'flex' : 'none'; api.ui.camDrill.marker.style.display = proc.camDrillingOn ? 'flex' : 'none';
api.ui.finishing.marker.style.display = api.ui.camOutline.marker.style.display = proc.camOutlineOn ? 'flex' : 'none';
proc.finishingOn || api.ui.camContour.marker.style.display =
proc.finishingXOn || proc.camContourXOn || proc.camContourYOn ? 'flex' : 'none';
proc.finishingYOn ? 'flex' : 'none';
}); });
} }
@ -386,11 +385,11 @@
outp = settings.process, outp = settings.process,
units = settings.controller.units === 'in' ? 25.4 : 1, units = settings.controller.units === 'in' ? 25.4 : 1,
resolution = outp.camTolerance * units, resolution = outp.camTolerance * units,
diameter = getToolDiameter(settings, proc.finishingTool), diameter = getToolDiameter(settings, proc.camOutlineTool),
tool = getToolById(settings, proc.finishingTool), tool = getToolById(settings, proc.camOutlineTool),
toolStep = diameter * proc.finishingOver, toolStep = diameter * proc.camOutlineOver,
traceJoin = diameter / 2, traceJoin = diameter / 2,
pocketOnly = proc.camPocketOnlyFinish, pocketOnly = proc.camOutlinePocket,
bounds = widget.getBoundingBox().clone(), bounds = widget.getBoundingBox().clone(),
minX = bounds.min.x,// - diameter, minX = bounds.min.x,// - diameter,
maxX = bounds.max.x,// + diameter, maxX = bounds.max.x,// + diameter,
@ -412,7 +411,7 @@
diameter: diameter, diameter: diameter,
resolution: resolution resolution: resolution
}, },
toolOffset = createToolProfile(settings, proc.finishingTool, topo), toolOffset = createToolProfile(settings, proc.camOutlineTool, topo),
newslices = [], newslices = [],
newlines, newlines,
newtop, newtop,
@ -503,14 +502,14 @@
} }
// do x linear finishing // do x linear finishing
if (proc.finishingXOn) { if (proc.camContourXOn) {
startTime = time(); startTime = time();
// emit slice per X // emit slice per X
for (x = minX; x <= maxX; x += toolStep) { for (x = minX; x <= maxX; x += toolStep) {
gridx = Math.round(((x - minX) / boundsX) * stepsx); gridx = Math.round(((x - minX) / boundsX) * stepsx);
ly = gridy = 0; ly = gridy = 0;
slice = newSlice(gridx, mesh.newGroup ? mesh.newGroup() : null); slice = newSlice(gridx, mesh.newGroup ? mesh.newGroup() : null);
slice.camMode = CPRO.FINISH_X; slice.camMode = CPRO.CONTOUR_X;
slice.lines = newlines = []; slice.lines = newlines = [];
newtop = slice.addTop(newPolygon().setOpen()).poly; newtop = slice.addTop(newPolygon().setOpen()).poly;
newtrace = newPolygon().setOpen(); newtrace = newPolygon().setOpen();
@ -560,14 +559,14 @@
} }
// do y linear finishing // do y linear finishing
if (proc.finishingYOn) { if (proc.camContourYOn) {
startTime = time(); startTime = time();
// emit slice per Y // emit slice per Y
for (y = minY; y <= maxY; y += toolStep) { for (y = minY; y <= maxY; y += toolStep) {
gridy = Math.round(((y - minY) / boundsY) * stepsy); gridy = Math.round(((y - minY) / boundsY) * stepsy);
lx = gridx = 0; lx = gridx = 0;
slice = newSlice(gridy, mesh.newGroup ? mesh.newGroup() : null); slice = newSlice(gridy, mesh.newGroup ? mesh.newGroup() : null);
slice.camMode = CPRO.FINISH_Y; slice.camMode = CPRO.CONTOUR_Y;
slice.lines = newlines = []; slice.lines = newlines = [];
newtop = slice.addTop(newPolygon().setOpen()).poly; newtop = slice.addTop(newPolygon().setOpen()).poly;
newtrace = newPolygon().setOpen(); newtrace = newPolygon().setOpen();
@ -845,19 +844,19 @@
sliceAll = widget.slices = [], sliceAll = widget.slices = [],
unitsName = settings.controller.units, unitsName = settings.controller.units,
units = unitsName === 'in' ? 25.4 : 1, units = unitsName === 'in' ? 25.4 : 1,
roughToolDiam = getToolDiameter(conf, proc.roughingTool), roughToolDiam = getToolDiameter(conf, proc.camRoughTool),
finishToolDiam = getToolDiameter(conf, proc.finishingTool), finishToolDiam = getToolDiameter(conf, proc.camOutlineTool),
drillToolDiam = getToolDiameter(conf, proc.drillTool), drillToolDiam = getToolDiameter(conf, proc.camDrillTool),
procRough = proc.roughingOn && proc.roughingDown && roughToolDiam, procRough = proc.camRoughOn && proc.camRoughDown && roughToolDiam,
procFinish = proc.finishingOn && proc.finishingDown && finishToolDiam, procFinish = proc.camOutlineOn && proc.camOutlineDown && finishToolDiam,
procFinishX = proc.finishingXOn && proc.finishingPlunge && finishToolDiam, procFinishX = proc.camContourXOn && proc.camOutlinePlunge && finishToolDiam,
procFinishY = proc.finishingYOn && proc.finishingPlunge && finishToolDiam, procFinishY = proc.camContourYOn && proc.camOutlinePlunge && finishToolDiam,
anyFinish = procFinish || procFinishX || procFinishY, anyFinish = procFinish || procFinishX || procFinishY,
procFacing = proc.roughingOn && proc.camZTopOffset, procFacing = proc.camRoughOn && proc.camZTopOffset,
procDrill = proc.drillingOn && proc.drillDown && proc.drillDownSpeed, procDrill = proc.camDrillingOn && proc.camDrillDown && proc.camDrillDownSpeed,
sliceDepth = Math.max(0.1, Math.min(proc.roughingDown, proc.finishingDown) / 3) * units, sliceDepth = Math.max(0.1, Math.min(proc.camRoughDown, proc.camOutlineDown) / 3) * units,
pocketOnlyRough = proc.camPocketOnlyRough, pocketOnlyRough = proc.camRoughPocket,
pocketOnlyFinish = proc.camPocketOnlyFinish, pocketOnlyFinish = proc.camOutlinePocket,
addTabsRough = procRough && proc.camTabsOn && !pocketOnlyRough, addTabsRough = procRough && proc.camTabsOn && !pocketOnlyRough,
addTabsFinish = procFinish && proc.camTabsOn && !pocketOnlyFinish, addTabsFinish = procFinish && proc.camTabsOn && !pocketOnlyFinish,
tabWidth = proc.camTabsWidth * units, tabWidth = proc.camTabsWidth * units,
@ -865,7 +864,7 @@
mesh = widget.mesh, mesh = widget.mesh,
bounds = widget.getBoundingBox(), bounds = widget.getBoundingBox(),
zMin = Math.max(bounds.min.z, proc.camZBottom) * units, zMin = Math.max(bounds.min.z, proc.camZBottom) * units,
roughingStock = proc.roughingStock * units, camRoughStock = proc.camRoughStock * units,
shellRough, shellRough,
shellFinish, shellFinish,
facePolys, facePolys,
@ -959,14 +958,14 @@
if (procRough && !pocketOnlyRough) { if (procRough && !pocketOnlyRough) {
// expand shell by half tool diameter + stock to leave // expand shell by half tool diameter + stock to leave
shellRough = facePolys = POLY.expand(shellRough, (roughToolDiam / 2) + roughingStock, 0); shellRough = facePolys = POLY.expand(shellRough, (roughToolDiam / 2) + camRoughStock, 0);
} else { } else {
// expand shell minimally triggering a clean // expand shell minimally triggering a clean
shellRough = facePolys = POLY.expand(shellRough, 0.01, 0); shellRough = facePolys = POLY.expand(shellRough, 0.01, 0);
} }
if (anyFinish && pocketOnlyRough && !pocketOnlyFinish) { if (anyFinish && pocketOnlyRough && !pocketOnlyFinish) {
facePolys = POLY.expand(shellRough, (roughToolDiam / 2) + roughingStock, 0); facePolys = POLY.expand(shellRough, (roughToolDiam / 2) + camRoughStock, 0);
} }
if (anyFinish && pocketOnlyFinish) { if (anyFinish && pocketOnlyFinish) {
@ -977,7 +976,7 @@
if (procFacing) { if (procFacing) {
let ztop = bounds.max.z, let ztop = bounds.max.z,
zpos = ztop + (proc.camZTopOffset * units), zpos = ztop + (proc.camZTopOffset * units),
zstep = proc.roughingDown * units; zstep = proc.camRoughDown * units;
while (zpos >= ztop) { while (zpos >= ztop) {
zpos = zpos - Math.min(zstep, zpos - ztop); zpos = zpos - Math.min(zstep, zpos - ztop);
@ -996,16 +995,16 @@
if (procRough) { if (procRough) {
let selected = []; let selected = [];
selectSlices(slices, proc.roughingDown * units, CPRO.ROUGH, selected); selectSlices(slices, proc.camRoughDown * units, CPRO.ROUGH, selected);
sliceAll.appendAll(selected); sliceAll.appendAll(selected);
if (!proc.roughingPocket) { if (!proc.camRoughVoid) {
thruHoles = holes(slices, roughToolDiam + roughingStock); thruHoles = holes(slices, roughToolDiam + camRoughStock);
} }
} }
if (procFinish) { if (procFinish) {
let selected = []; let selected = [];
selectSlices(slices, proc.finishingDown * units, CPRO.FINISH, selected); selectSlices(slices, proc.camOutlineDown * units, CPRO.OUTLINE, selected);
sliceAll.appendAll(selected); sliceAll.appendAll(selected);
} }
@ -1076,9 +1075,9 @@
let tool; let tool;
let profile; let profile;
if (procFinish) { if (procFinish) {
tool = getToolById(conf, proc.finishingTool); tool = getToolById(conf, proc.camOutlineTool);
if (tool.type !== 'endmill') { if (tool.type !== 'endmill') {
profile = createToolProfile(conf, proc.finishingTool, widget.topo); profile = createToolProfile(conf, proc.camOutlineTool, widget.topo);
} }
} }
@ -1090,14 +1089,14 @@
switch (slice.camMode) { switch (slice.camMode) {
case CPRO.FACING: case CPRO.FACING:
modekey = "facing"; modekey = "facing";
createFacingSlices(slice, facePolys, roughToolDiam, proc.roughingOver, pocketOnlyRough); createFacingSlices(slice, facePolys, roughToolDiam, proc.camRoughOver, pocketOnlyRough);
break; break;
case CPRO.ROUGH: case CPRO.ROUGH:
modekey = "roughing"; modekey = "roughing";
createRoughingSlices(slice, shellRough, roughToolDiam, roughingStock, proc.roughingOver, pocketOnlyRough, thruHoles); createRoughingSlices(slice, shellRough, roughToolDiam, camRoughStock, proc.camRoughOver, pocketOnlyRough, thruHoles);
if (addTabsRough) addCutoutTabs(slice, roughToolDiam); if (addTabsRough) addCutoutTabs(slice, roughToolDiam);
break; break;
case CPRO.FINISH: case CPRO.OUTLINE:
modekey = "finishing"; modekey = "finishing";
if (profile) findTracingPaths(widget, slice, tool, profile); if (profile) findTracingPaths(widget, slice, tool, profile);
createFinishingSlices(slice, shellFinish, finishToolDiam, pocketOnlyFinish); createFinishingSlices(slice, shellFinish, finishToolDiam, pocketOnlyFinish);
@ -1119,7 +1118,7 @@
let tops = slice.tops, let tops = slice.tops,
layers = slice.layers, layers = slice.layers,
outline = layers.outline, outline = layers.outline,
open = (slice.camMode === CPRO.FINISH_X || slice.camMode === CPRO.FINISH_Y); open = (slice.camMode === CPRO.CONTOUR_X || slice.camMode === CPRO.CONTOUR_Y);
layers.outline.clear(); // slice raw edges layers.outline.clear(); // slice raw edges
layers.trace.clear(); // roughing layers.trace.clear(); // roughing
@ -1137,13 +1136,13 @@
let layer; let layer;
slice.tops.forEach(function(top) { slice.tops.forEach(function(top) {
switch (slice.camMode) { switch (slice.camMode) {
case CPRO.FINISH: case CPRO.OUTLINE:
layer = layers.solid; layer = layers.solid;
break; break;
case CPRO.FINISH_X: case CPRO.CONTOUR_X:
layer = layers.bridge; layer = layers.bridge;
break; break;
case CPRO.FINISH_Y: case CPRO.CONTOUR_Y:
layer = layers.flat; layer = layers.flat;
break; break;
default: // roughing default: // roughing
@ -1217,9 +1216,9 @@
depthFirst = process.camDepthFirst, depthFirst = process.camDepthFirst,
easeDown = process.camEaseDown, easeDown = process.camEaseDown,
tolerance = process.camTolerance * units, tolerance = process.camTolerance * units,
drillDown = process.drillDown * units, drillDown = process.camDrillDown * units,
drillLift = process.drillLift * units, drillLift = process.camDrillLift * units,
drillDwell = process.drillDwell, drillDwell = process.camDrillDwell,
newOutput = widgetIndex === 0 ? [] : print.output, newOutput = widgetIndex === 0 ? [] : print.output,
layerOut = [], layerOut = [],
printPoint, printPoint,
@ -1463,8 +1462,8 @@
switch (slice.camMode) { switch (slice.camMode) {
case modes.FACING: case modes.FACING:
setTool(process.roughingTool, process.roughingSpeed, 0); setTool(process.camRoughTool, process.camRoughSpeed, 0);
spindle = Math.min(spindleMax, process.roughingSpindle); spindle = Math.min(spindleMax, process.camRoughSpindle);
slice.tops.forEach(function(top) { slice.tops.forEach(function(top) {
if (!top.traces) return; if (!top.traces) return;
let polys = []; let polys = [];
@ -1477,7 +1476,7 @@
} }
}); });
// set winding specified in output // set winding specified in output
POLY.setWinding(polys, process.outputClockwise, false); POLY.setWinding(polys, process.camConventional, false);
printPoint = poly2polyEmit(polys, printPoint, function(poly, index, count) { printPoint = poly2polyEmit(polys, printPoint, function(poly, index, count) {
poly.forEachPoint(function(point, pidx, points, offset) { poly.forEachPoint(function(point, pidx, points, offset) {
camOut(point.clone(), offset !== 0); camOut(point.clone(), offset !== 0);
@ -1487,17 +1486,17 @@
}); });
break; break;
case modes.ROUGH: case modes.ROUGH:
case modes.FINISH: case modes.OUTLINE:
let dir = process.outputClockwise; let dir = process.camConventional;
if (slice.camMode === modes.ROUGH) { if (slice.camMode === modes.ROUGH) {
setTool(process.roughingTool, process.roughingSpeed, process.roughingPlunge); setTool(process.camRoughTool, process.camRoughSpeed, process.camRoughPlunge);
spindle = Math.min(spindleMax, process.roughingSpindle); spindle = Math.min(spindleMax, process.camRoughSpindle);
depthData.roughDiam = toolDiam; depthData.roughDiam = toolDiam;
} else { } else {
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.camOutlineTool, process.camOutlineSpeed, process.camOutlinePlunge);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.camOutlineSpindle);
depthData.finishDiam = toolDiam; depthData.finishDiam = toolDiam;
if (!process.camPocketOnlyFinish) { if (!process.camOutlinePocket) {
dir = !dir; dir = !dir;
} }
} }
@ -1529,14 +1528,14 @@
} }
}); });
break; break;
case modes.FINISH_X: case modes.CONTOUR_X:
case modes.FINISH_Y: case modes.CONTOUR_Y:
if (isNewMode || !printPoint) { if (isNewMode || !printPoint) {
// force start at lower left corner // force start at lower left corner
printPoint = newPoint(bounds.min.x,bounds.min.y,zmax); printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
} }
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.camContourTool, process.camContourSpeed, process.camFastFeedZ);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.camContourSpindle);
depthData.finishDiam = toolDiam; depthData.finishDiam = toolDiam;
// todo find closest next trace/trace-point // todo find closest next trace/trace-point
slice.tops.forEach(function(top) { slice.tops.forEach(function(top) {
@ -1547,7 +1546,7 @@
polys.push({first:poly.first(), last:poly.last(), poly:poly}); polys.push({first:poly.first(), last:poly.last(), poly:poly});
}); });
if (depthFirst) { if (depthFirst) {
(slice.camMode === modes.FINISH_X ? depthData.linearx : depthData.lineary).appendAll(polys); (slice.camMode === modes.CONTOUR_X ? depthData.linearx : depthData.lineary).appendAll(polys);
} else { } else {
printPoint = tip2tipEmit(polys, printPoint, function(el, point, count) { printPoint = tip2tipEmit(polys, printPoint, function(el, point, count) {
poly = el.poly; poly = el.poly;
@ -1562,7 +1561,7 @@
}); });
break; break;
case modes.DRILL: case modes.DRILL:
setTool(process.drillTool, process.drillDownSpeed, process.drillDownSpeed); setTool(process.camDrillTool, process.camDrillDownSpeed, process.camDrillDownSpeed);
// drilling is always depth-first // drilling is always depth-first
slice.tops.forEach(function(top) { slice.tops.forEach(function(top) {
if (!top.traces) return; if (!top.traces) return;
@ -1577,8 +1576,8 @@
if (depthFirst) { if (depthFirst) {
// roughing depth first // roughing depth first
if (depthData.rough.length > 0) { if (depthData.rough.length > 0) {
setTool(process.roughingTool, process.roughingSpeed, process.roughingPlunge); setTool(process.camRoughTool, process.camRoughSpeed, process.camRoughPlunge);
spindle = Math.min(spindleMax, process.roughingSpindle); spindle = Math.min(spindleMax, process.camRoughSpindle);
printPoint = poly2polyDepthFirstEmit(depthData.rough, printPoint, function(poly, index, count, fromPoint) { printPoint = poly2polyDepthFirstEmit(depthData.rough, printPoint, function(poly, index, count, fromPoint) {
let last = null; let last = null;
if (easeDown && poly.isClosed()) { if (easeDown && poly.isClosed()) {
@ -1592,12 +1591,12 @@
} }
newLayer(); newLayer();
return last; return last;
}, depthData.roughDiam * process.roughingOver * 1.01); }, depthData.roughDiam * process.camRoughOver * 1.01);
} }
// finishing depth first // finishing depth first
if (depthData.finish.length > 0) { if (depthData.finish.length > 0) {
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.camOutlineTool, process.camOutlineSpeed, process.camOutlinePlunge);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.camOutlineSpindle);
printPoint = poly2polyDepthFirstEmit(depthData.finish, printPoint, function(poly, index, count, fromPoint) { printPoint = poly2polyDepthFirstEmit(depthData.finish, printPoint, function(poly, index, count, fromPoint) {
let last = null; let last = null;
if (easeDown && poly.isClosed()) { if (easeDown && poly.isClosed()) {
@ -1616,8 +1615,8 @@
} }
// two modes for deferred finishing: x then y or combined // two modes for deferred finishing: x then y or combined
if (process.finishCurvesOnly) { if (process.finishCurvesOnly) {
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.camOutlineTool, process.camOutlineSpeed, process.camOutlinePlunge);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.camOutlineSpindle);
// combined deferred linear x and y finishing // combined deferred linear x and y finishing
let linearxy = [].appendAll(depthData.linearx).appendAll(depthData.lineary); let linearxy = [].appendAll(depthData.linearx).appendAll(depthData.lineary);
printPoint = tip2tipEmit(linearxy, printPoint, function(el, point, count) { printPoint = tip2tipEmit(linearxy, printPoint, function(el, point, count) {
@ -1632,8 +1631,8 @@
return lastPoint; return lastPoint;
}); });
} else { } else {
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.camOutlineTool, process.camOutlineSpeed, process.camOutlinePlunge);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.camOutlineSpindle);
// deferred linear x finishing // deferred linear x finishing
if (depthData.linearx.length > 0) { if (depthData.linearx.length > 0) {
// force start at lower left corner // force start at lower left corner
@ -1666,7 +1665,7 @@
// drilling is always depth first // drilling is always depth first
if (depthData.drill.length > 0) { if (depthData.drill.length > 0) {
setTool(process.drillTool, process.drillDownSpeed, process.drillDownSpeed); setTool(process.camDrillTool, process.camDrillDownSpeed, process.camDrillDownSpeed);
emitDrills(depthData.drill); emitDrills(depthData.drill);
} }
@ -1885,7 +1884,7 @@
} }
if (!stripComments) { if (!stripComments) {
append(`; Generated by Kiri:Moto ${KIRI.VERSION}`); append(`; Generated by Kiri:Moto ${KIRI.version}`);
append(`; ${new Date().toString()}`); append(`; ${new Date().toString()}`);
filterEmit(["; Bed left:{left} right:{right} top:{top} bottom:{bottom}"], consts); filterEmit(["; Bed left:{left} right:{right} top:{top} bottom:{bottom}"], consts);
append(`; Target: ${settings.filter[settings.mode]}`); append(`; Target: ${settings.filter[settings.mode]}`);

View file

@ -915,7 +915,7 @@
device = settings.device, device = settings.device,
extruders = device.extruders, extruders = device.extruders,
process = settings.process, process = settings.process,
fan_power = device.gcodeFan, gcodeFan = device.gcodeFan,
gcodeLayer = device.gcodeLayer, gcodeLayer = device.gcodeLayer,
gcodeTrack = device.gcodeTrack, gcodeTrack = device.gcodeTrack,
tool = 0, tool = 0,
@ -1008,7 +1008,7 @@
arr.forEach(function(line) { appendSub(line) }); arr.forEach(function(line) { appendSub(line) });
} }
append(`; Generated by Kiri:Moto ${KIRI.VERSION}`); append(`; Generated by Kiri:Moto ${KIRI.version}`);
append(`; ${new Date().toString()}`); append(`; ${new Date().toString()}`);
appendSub("; Bed left:{left} right:{right} top:{top} bottom:{bottom}"); appendSub("; Bed left:{left} right:{right} top:{top} bottom:{bottom}");
append(`; Target: ${settings.filter[settings.mode]}`); append(`; Target: ${settings.filter[settings.mode]}`);
@ -1142,8 +1142,8 @@
} }
// enable fan at fan layer // enable fan at fan layer
if (fan_power && layer === process.outputFanLayer) { if (gcodeFan && layer === process.outputFanLayer) {
appendSub(fan_power); appendAllSub(gcodeFan);
} }
// second layer transitions // second layer transitions
@ -1242,7 +1242,7 @@
// emit tracked progress // emit tracked progress
if (gcodeTrack && progress != lastProgress) { if (gcodeTrack && progress != lastProgress) {
appendSub(gcodeTrack); appendAllSub(gcodeTrack);
lastProgress = progress; lastProgress = progress;
} }

View file

@ -92,7 +92,7 @@ select option[favorite="1"] {
th, tr, td, span, div, label, button { th, tr, td, span, div, label, button {
user-select: none; user-select: none;
} }
th, tr, td { th, tr, td, label {
white-space: nowrap; white-space: nowrap;
} }
.noselect { .noselect {
@ -117,6 +117,9 @@ th, tr, td {
.auto { .auto {
flex-basis: auto; flex-basis: auto;
} }
.basis-50 {
flex-basis: 50%;
}
.grow { .grow {
flex-grow: 1; flex-grow: 1;
} }
@ -411,13 +414,16 @@ th, tr, td {
.lt-enabled:hover .pop-lcol { .lt-enabled:hover .pop-lcol {
display: flex; display: flex;
} }
@media only screen @media only screen and (max-height : 850px) {
and (min-device-width : 768px) .lt-menu, .pop-lcol {
and (max-device-width : 1024px) font-size: 16px !important;
and (orientation : landscape) { }
.lt-menu svg { .lt-menu svg {
font-size: 30px !important; font-size: 30px !important;
} }
.pop-lcol svg {
font-size: 20px !important;
}
} }
.ext-buttons button { .ext-buttons button {

View file

@ -160,6 +160,7 @@
</div> </div>
<input id="rot_z" class="value center" size="5"/ value="0"> <input id="rot_z" class="value center" size="5"/ value="0">
</div> </div>
<!-- <div id="lay-flat" class="col j-center center">lay flat</div> -->
<div id="unrotate" class="col j-center">reset</div> <div id="unrotate" class="col j-center">reset</div>
</div> </div>
</div> </div>

View file

@ -1,4 +1,4 @@
// english. other language maps will defer to english "spindle rpm"// english. other language maps will defer to english
// map for any missing key/value pairs // map for any missing key/value pairs
kiri.lang['en'] = kiri.lang['en'] =
kiri.lang['en-us'] = { kiri.lang['en-us'] = {
@ -39,10 +39,10 @@ kiri.lang['en-us'] = {
dv_prog_l: "output on each % progress", dv_prog_l: "output on each % progress",
dv_layr_s: "layer", dv_layr_s: "layer",
dv_layr_l: "output at each\nlayer change", dv_layr_l: "output at each\nlayer change",
dv_tksp_s: "token spacing", dv_tksp_s: "token spacer",
dv_tksp_l: "gcode token spacer", dv_tksp_l: "add a space between\ngcode axis parameters\nG0X0Y0X0\nvs\nG0 X0 Y0 Z0",
dv_strc_s: "strip comments", dv_strc_s: "strip comments",
dv_strc_l: "strip gcode comments", dv_strc_l: "strip gcode comments\ncomments begin with ;",
dv_fext_s: "file extension", dv_fext_s: "file extension",
dv_fext_l: "file name extension", dv_fext_l: "file name extension",
dv_dwll_s: "dwell", dv_dwll_s: "dwell",
@ -229,7 +229,7 @@ kiri.lang['en-us'] = {
// CNC COMMON terms // CNC COMMON terms
cc_tool: "tool", cc_tool: "tool",
cc_spnd_s: "spindle speed", cc_spnd_s: "spindle rpm",
cc_spnd_l: "spindle speed in\nrevolutions / minute", cc_spnd_l: "spindle speed in\nrevolutions / minute",
cc_sovr_s: "step over", cc_sovr_s: "step over",
cc_sovr_l: "0.1 - 1.0\npercentage of\ntool diameter", cc_sovr_l: "0.1 - 1.0\npercentage of\ntool diameter",
@ -250,7 +250,7 @@ kiri.lang['en-us'] = {
cc_rzpd_l: "max z moves feedrate\nin workspace units / minute", cc_rzpd_l: "max z moves feedrate\nin workspace units / minute",
// CNC ROUGHING // CNC ROUGHING
cr_menu: "roughing", cr_menu: "rough",
cr_lsto_s: "leave stock", cr_lsto_s: "leave stock",
cr_lsto_l: "horizontal offset from vertical faces\nstock to leave for finishing pass\nin workspace units", cr_lsto_l: "horizontal offset from vertical faces\nstock to leave for finishing pass\nin workspace units",
cr_ease_s: "ease down", cr_ease_s: "ease down",
@ -258,21 +258,30 @@ kiri.lang['en-us'] = {
cr_clrp_s: "pocket clear", cr_clrp_s: "pocket clear",
cr_clrp_l: "mill out entire pocket instead\nof just cutting the outline", cr_clrp_l: "mill out entire pocket instead\nof just cutting the outline",
// CNC FINISHING // CNC OUTLINE
cf_menu: "finishing", co_menu: "outline",
cf_watr_s: "enable",
cf_watr_l: "enable contour finishing\ndisabled when pocketing",
// CNC CONTOUR
cn_menu: "contour",
cf_angl_s: "max angle", cf_angl_s: "max angle",
cf_angl_l: "angles greater than this\nare considered vertical", cf_angl_l: "angles greater than this\nare considered vertical",
cf_watr_s: "enable waterline",
cf_watr_l: "enable contour finishing\ndisabled when pocketing",
cf_linx_s: "enable linear x",
cf_linx_l: "linear x-axis finishing",
cf_liny_s: "enable linear y",
cf_liny_l: "linear y-axis finishing",
cf_curv_s: "curves only", cf_curv_s: "curves only",
cf_curv_l: "limit linear cleanup\nto curved surfaces", cf_curv_l: "limit linear cleanup\nto curved surfaces",
cf_linx_s: "enable x pass",
cf_linx_l: "linear x-axis finishing",
cf_liny_s: "enable y pass",
cf_liny_l: "linear y-axis finishing",
// CNC CONTOUR
cu_menu: "trace",
// CNC FINISHING
// cf_menu: "finishing",
// CNC DRILLING // CNC DRILLING
cd_menu: "drilling", cd_menu: "drill",
cd_plpr_s: "plunge per", cd_plpr_s: "plunge per",
cd_plpr_l: "max plunge between\ndwell periods\nin workspace units\n0 to disable", cd_plpr_l: "max plunge between\ndwell periods\nin workspace units\n0 to disable",
cd_dwll_s: "dwell time", cd_dwll_s: "dwell time",