a new take on workspace units
This commit is contained in:
parent
7ad9559521
commit
7db47ca185
4 changed files with 101 additions and 60 deletions
|
|
@ -1281,8 +1281,8 @@
|
||||||
|
|
||||||
device: UC.newGroup(LANG.dv_gr_dev, $('device'), {group:"ddev", inline:true}),
|
device: UC.newGroup(LANG.dv_gr_dev, $('device'), {group:"ddev", inline:true}),
|
||||||
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:"60%", text:true, action:updateDeviceName}),
|
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:"60%", text:true, action:updateDeviceName}),
|
||||||
bedWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toFloat, size:6}),
|
bedWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toFloat, size:6, units:true}),
|
||||||
bedDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toFloat, size:6}),
|
bedDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toFloat, size:6, units:true}),
|
||||||
maxHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toFloat, size:6, modes:FDM_SLA}),
|
maxHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toFloat, size:6, modes:FDM_SLA}),
|
||||||
spindleMax: UC.newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:UC.toInt, size: 6, modes:CAM}),
|
spindleMax: UC.newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:UC.toInt, size: 6, modes:CAM}),
|
||||||
deviceOrigin: UC.newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l, modes:GCODE}),
|
deviceOrigin: UC.newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l, modes:GCODE}),
|
||||||
|
|
@ -1398,20 +1398,20 @@
|
||||||
camRough: UC.newGroup(LANG.cr_menu, null, {modes:CAM, marker:true}),
|
camRough: UC.newGroup(LANG.cr_menu, null, {modes:CAM, marker:true}),
|
||||||
camRoughTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
|
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, visible:spindleShow}),
|
camRoughSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||||
camRoughOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.1,1.0), 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, units:true}),
|
||||||
camRoughDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM}),
|
camRoughDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camRoughSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
|
camRoughSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||||
camRoughPlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM}),
|
camRoughPlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||||
camRoughStock: UC.newInput(LANG.cr_lsto_s, {title:LANG.cr_lsto_l, convert:UC.toFloat, modes:CAM}),
|
camRoughStock: UC.newInput(LANG.cr_lsto_s, {title:LANG.cr_lsto_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camRoughVoid: UC.newBoolean(LANG.cr_clrp_s, onBooleanClick, {title:LANG.cr_clrp_l, modes:CAM}),
|
camRoughVoid: UC.newBoolean(LANG.cr_clrp_s, onBooleanClick, {title:LANG.cr_clrp_l, modes:CAM}),
|
||||||
camRoughSep: UC.newBlank({class:"pop-sep"}),
|
camRoughSep: UC.newBlank({class:"pop-sep"}),
|
||||||
camRoughOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
|
camRoughOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
|
||||||
camOutline: UC.newGroup(LANG.co_menu, null, {modes:CAM, marker:true}),
|
camOutline: UC.newGroup(LANG.co_menu, null, {modes:CAM, marker:true}),
|
||||||
camOutlineTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
|
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, visible:spindleShow}),
|
camOutlineSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||||
camOutlineDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM}),
|
camOutlineDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camOutlineSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
|
camOutlineSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||||
camOutlinePlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM}),
|
camOutlinePlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||||
camOutlineWide: UC.newBoolean(LANG.co_wide_s, onBooleanClick, {title:LANG.co_wide_l, modes:CAM, show:() => { return !UI.camOutlineIn.checked }}),
|
camOutlineWide: UC.newBoolean(LANG.co_wide_s, onBooleanClick, {title:LANG.co_wide_l, modes:CAM, show:() => { return !UI.camOutlineIn.checked }}),
|
||||||
camOutlineIn: UC.newBoolean(LANG.co_olin_s, onBooleanClick, {title:LANG.co_olin_l, modes:CAM}),
|
camOutlineIn: UC.newBoolean(LANG.co_olin_s, onBooleanClick, {title:LANG.co_olin_l, modes:CAM}),
|
||||||
camOutlineSep: UC.newBlank({class:"pop-sep"}),
|
camOutlineSep: UC.newBlank({class:"pop-sep"}),
|
||||||
|
|
@ -1419,8 +1419,8 @@
|
||||||
camContour: UC.newGroup(LANG.cn_menu, null, {modes:CAM, marker:true}),
|
camContour: UC.newGroup(LANG.cn_menu, null, {modes:CAM, marker:true}),
|
||||||
camContourTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
|
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, visible:spindleShow}),
|
camContourSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||||
camContourOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:CAM}),
|
camContourOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:CAM, units:true}),
|
||||||
camContourSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}),
|
camContourSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||||
camContourAngle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90), 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}),
|
camContourCurves: UC.newBoolean(LANG.cf_curv_s, onBooleanClick, {title:LANG.cf_curv_l, modes:CAM}),
|
||||||
camContourSep: UC.newBlank({class:"pop-sep"}),
|
camContourSep: UC.newBlank({class:"pop-sep"}),
|
||||||
|
|
@ -1434,10 +1434,10 @@
|
||||||
camDrill: UC.newGroup(LANG.cd_menu, null, {modes:CAM, marker:true}),
|
camDrill: UC.newGroup(LANG.cd_menu, null, {modes:CAM, marker:true}),
|
||||||
camDrillTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
|
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, visible:spindleShow}),
|
camDrillSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||||
camDrillDown: UC.newInput(LANG.cd_plpr_s, {title:LANG.cd_plpr_l, convert:UC.toFloat, modes:CAM}),
|
camDrillDown: UC.newInput(LANG.cd_plpr_s, {title:LANG.cd_plpr_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camDrillDownSpeed: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toFloat, modes:CAM}),
|
camDrillDownSpeed: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camDrillDwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_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}),
|
camDrillLift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camDrillSep: UC.newBlank({class:"pop-sep"}),
|
camDrillSep: UC.newBlank({class:"pop-sep"}),
|
||||||
camDrillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
|
camDrillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
|
||||||
camDrillSep: UC.newBlank({class:"pop-sep"}),
|
camDrillSep: UC.newBlank({class:"pop-sep"}),
|
||||||
|
|
@ -1445,26 +1445,26 @@
|
||||||
camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:true, show:() => { return UI.camOutlineOn.checked }}),
|
camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:true, show:() => { return UI.camOutlineOn.checked }}),
|
||||||
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}),
|
||||||
camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_l, convert:UC.toFloat, bound:UC.bound(0.1,100), modes:CAM}),
|
camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_l, convert:UC.toFloat, bound:UC.bound(0.1,100), modes:CAM, units:true}),
|
||||||
camTabsHeight: UC.newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:UC.toFloat, bound:UC.bound(0.1,100), modes:CAM}),
|
camTabsHeight: UC.newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:UC.toFloat, bound:UC.bound(0.1,100), modes:CAM, units:true}),
|
||||||
camTabSep: UC.newBlank({class:"pop-sep"}),
|
camTabSep: UC.newBlank({class:"pop-sep"}),
|
||||||
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, units:true}),
|
||||||
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, units:true}),
|
||||||
camStockZ: UC.newInput(LANG.cs_hght_s, {title:LANG.cs_hght_l, convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
|
camStockZ: UC.newInput(LANG.cs_hght_s, {title:LANG.cs_hght_l, convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM, units:true}),
|
||||||
camStockOffset: UC.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
|
camStockOffset: UC.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
|
||||||
|
|
||||||
camCommon: UC.newGroup(LANG.cc_menu, null, {modes:CAM}),
|
camCommon: UC.newGroup(LANG.cc_menu, null, {modes:CAM}),
|
||||||
camZTopOffset: UC.newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:UC.toFloat, modes:CAM}),
|
camZTopOffset: UC.newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camZBottom: UC.newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:UC.toFloat, modes:CAM, trigger: true}),
|
camZBottom: UC.newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:UC.toFloat, modes:CAM, units:true, trigger: true}),
|
||||||
camZClearance: UC.newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:UC.toFloat, bound:UC.bound(0.01,100), modes:CAM}),
|
camZClearance: UC.newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:UC.toFloat, bound:UC.bound(0.01,100), modes:CAM, units:true}),
|
||||||
camZThru: UC.newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:UC.toFloat, bound:UC.bound(0.0,100), modes:CAM, show:() => { return UI.camZBottom.value == 0 }}),
|
camZThru: UC.newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:UC.toFloat, bound:UC.bound(0.0,100), modes:CAM, units:true, show:() => { return UI.camZBottom.value == 0 }}),
|
||||||
camFastFeedZ: UC.newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:UC.toInt, modes:CAM}),
|
camFastFeedZ: UC.newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camFastFeed: UC.newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:UC.toInt, modes:CAM}),
|
camFastFeed: UC.newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||||
camTolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0.001,1.0), modes:CAM}),
|
camTolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0.001,1.0), modes:CAM, units:true}),
|
||||||
|
|
||||||
laserLayout: UC.newGroup(LANG.lo_menu, null, {modes:LASER, group:"lz-lo"}),
|
laserLayout: UC.newGroup(LANG.lo_menu, null, {modes:LASER, group:"lz-lo"}),
|
||||||
outputTileSpacing: UC.newInput(LANG.ou_spac_s, {title:LANG.ou_spac_l, convert:UC.toInt, modes:LASER}),
|
outputTileSpacing: UC.newInput(LANG.ou_spac_s, {title:LANG.ou_spac_l, convert:UC.toInt, modes:LASER}),
|
||||||
|
|
|
||||||
|
|
@ -1432,7 +1432,11 @@
|
||||||
if (UI.hasOwnProperty(key)) {
|
if (UI.hasOwnProperty(key)) {
|
||||||
let uie = UI[key], typ = uie ? uie.type : null;
|
let uie = UI[key], typ = uie ? uie.type : null;
|
||||||
if (typ === 'text') {
|
if (typ === 'text') {
|
||||||
|
if (uie.setv) {
|
||||||
|
uie.setv(val);
|
||||||
|
} else {
|
||||||
uie.value = val;
|
uie.value = val;
|
||||||
|
}
|
||||||
} else if (typ === 'checkbox') {
|
} else if (typ === 'checkbox') {
|
||||||
uie.checked = val;
|
uie.checked = val;
|
||||||
} else if (typ === 'select-one') {
|
} else if (typ === 'select-one') {
|
||||||
|
|
@ -1549,6 +1553,10 @@
|
||||||
|
|
||||||
function updateSettings() {
|
function updateSettings() {
|
||||||
updateSettingsFromFields(settings.controller);
|
updateSettingsFromFields(settings.controller);
|
||||||
|
switch (settings.controller.units) {
|
||||||
|
case 'mm': UC.setUnits(1); break;
|
||||||
|
case 'in': UC.setUnits(25.4); break;
|
||||||
|
}
|
||||||
updateSettingsFromFields(settings.device);
|
updateSettingsFromFields(settings.device);
|
||||||
updateSettingsFromFields(settings.process);
|
updateSettingsFromFields(settings.process);
|
||||||
updateSettingsFromFields(settings.layers);
|
updateSettingsFromFields(settings.layers);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
poppable = {},
|
poppable = {},
|
||||||
hasModes = [],
|
hasModes = [],
|
||||||
isExpert = [],
|
isExpert = [],
|
||||||
|
setters = [],
|
||||||
letMode = null,
|
letMode = null,
|
||||||
letExpert = false,
|
letExpert = false,
|
||||||
letHoverPop = true,
|
letHoverPop = true,
|
||||||
|
|
@ -27,7 +28,8 @@
|
||||||
state = {},
|
state = {},
|
||||||
prefix = "tab",
|
prefix = "tab",
|
||||||
NOMODE = "nomode",
|
NOMODE = "nomode",
|
||||||
exitimer = undefined;
|
exitimer = undefined,
|
||||||
|
units = 1;
|
||||||
|
|
||||||
SELF.$ = (SELF.$ || function (id) { return DOC.getElementById(id) } );
|
SELF.$ = (SELF.$ || function (id) { return DOC.getElementById(id) } );
|
||||||
|
|
||||||
|
|
@ -58,6 +60,8 @@
|
||||||
newBlank: newBlank,
|
newBlank: newBlank,
|
||||||
newGroup: newGroup,
|
newGroup: newGroup,
|
||||||
setGroup: setGroup,
|
setGroup: setGroup,
|
||||||
|
setUnits: setUnits,
|
||||||
|
addUnits: addUnits,
|
||||||
hidePoppers: hidePoppers,
|
hidePoppers: hidePoppers,
|
||||||
confirm: confirm,
|
confirm: confirm,
|
||||||
prompt: prompt,
|
prompt: prompt,
|
||||||
|
|
@ -128,6 +132,11 @@
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
setMode(letMode, true);
|
setMode(letMode, true);
|
||||||
|
setters.forEach(input => {
|
||||||
|
if (input.setv) {
|
||||||
|
input.setv(input.real);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMode(mode, nohide) {
|
function setMode(mode, nohide) {
|
||||||
|
|
@ -295,21 +304,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toInt() {
|
|
||||||
let nv = this.value !== '' ? parseInt(this.value) : null;
|
|
||||||
if (isNaN(nv)) nv = 0;
|
|
||||||
if (nv !== null && this.bound) nv = this.bound(nv);
|
|
||||||
this.value = nv;
|
|
||||||
return nv;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toFloat() {
|
|
||||||
let nv = this.value !== '' ? parseFloat(this.value) : null;
|
|
||||||
if (nv !== null && this.bound) nv = this.bound(nv);
|
|
||||||
this.value = nv;
|
|
||||||
return nv;
|
|
||||||
}
|
|
||||||
|
|
||||||
function bound(low,high) {
|
function bound(low,high) {
|
||||||
return function(v) {
|
return function(v) {
|
||||||
if (isNaN(v)) return low;
|
if (isNaN(v)) return low;
|
||||||
|
|
@ -317,10 +311,38 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toInt() {
|
||||||
|
let nv = this.value !== '' ? parseInt(this.value) : null;
|
||||||
|
if (isNaN(nv)) nv = 0;
|
||||||
|
if (nv !== null && this.bound) nv = this.bound(nv);
|
||||||
|
this.value = nv;
|
||||||
|
if (this.setv) {
|
||||||
|
return this.real = Math.round(nv * units);
|
||||||
|
};
|
||||||
|
return nv;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toFloat() {
|
||||||
|
let nv = this.value !== '' ? parseFloat(this.value) : null;
|
||||||
|
if (nv !== null && this.bound) nv = this.bound(nv);
|
||||||
|
this.value = nv;
|
||||||
|
if (this.setv) {
|
||||||
|
return this.real = nv * units;
|
||||||
|
};
|
||||||
|
return nv;
|
||||||
|
}
|
||||||
|
|
||||||
function raw() {
|
function raw() {
|
||||||
return this.value !== '' ? this.value : null;
|
return this.value !== '' ? this.value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setUnits(v) {
|
||||||
|
if (v !== units) {
|
||||||
|
units = v;
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function newLabel(text) {
|
function newLabel(text) {
|
||||||
let label = DOC.createElement('label');
|
let label = DOC.createElement('label');
|
||||||
label.appendChild(DOC.createTextNode(text));
|
label.appendChild(DOC.createTextNode(text));
|
||||||
|
|
@ -596,7 +618,6 @@
|
||||||
});
|
});
|
||||||
ip.addEventListener('keyup', function(event) {
|
ip.addEventListener('keyup', function(event) {
|
||||||
if (event.keyCode === 13) {
|
if (event.keyCode === 13) {
|
||||||
// action(event);
|
|
||||||
ip.blur();
|
ip.blur();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -606,6 +627,9 @@
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (opt.units) {
|
||||||
|
addUnits(ip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!ip.convert) ip.convert = raw.bind(ip);
|
if (!ip.convert) ip.convert = raw.bind(ip);
|
||||||
ip.setVisible = row.setVisible;
|
ip.setVisible = row.setVisible;
|
||||||
|
|
@ -613,6 +637,19 @@
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addUnits(input) {
|
||||||
|
setters.push(input);
|
||||||
|
input.setv = function(value) {
|
||||||
|
if (typeof(value) === 'number') {
|
||||||
|
input.real = value;
|
||||||
|
input.value = value / units;
|
||||||
|
} else {
|
||||||
|
input.value = value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
function newRange(label, options) {
|
function newRange(label, options) {
|
||||||
let row = newDiv(options),
|
let row = newDiv(options),
|
||||||
ip = DOC.createElement('input'),
|
ip = DOC.createElement('input'),
|
||||||
|
|
|
||||||
|
|
@ -299,8 +299,7 @@
|
||||||
let mesh = widget.mesh,
|
let mesh = widget.mesh,
|
||||||
proc = settings.process,
|
proc = settings.process,
|
||||||
outp = settings.process,
|
outp = settings.process,
|
||||||
units = settings.controller.units === 'in' ? 25.4 : 1,
|
resolution = outp.camTolerance,
|
||||||
resolution = outp.camTolerance * units,
|
|
||||||
diameter = getToolDiameter(settings, proc.camContourTool),
|
diameter = getToolDiameter(settings, proc.camContourTool),
|
||||||
tool = getToolById(settings, proc.camContourTool),
|
tool = getToolById(settings, proc.camContourTool),
|
||||||
toolStep = diameter * proc.camContourOver,
|
toolStep = diameter * proc.camContourOver,
|
||||||
|
|
@ -311,7 +310,7 @@
|
||||||
maxX = bounds.max.x,// + diameter,
|
maxX = bounds.max.x,// + diameter,
|
||||||
minY = bounds.min.y,// - diameter,
|
minY = bounds.min.y,// - diameter,
|
||||||
maxY = bounds.max.y,// + diameter,
|
maxY = bounds.max.y,// + diameter,
|
||||||
zBottom = outp.camZBottom * units,
|
zBottom = outp.camZBottom,
|
||||||
boundsX = maxX - minX,
|
boundsX = maxX - minX,
|
||||||
boundsY = maxY - minY,
|
boundsY = maxY - minY,
|
||||||
maxangle = proc.camContourAngle,
|
maxangle = proc.camContourAngle,
|
||||||
|
|
@ -697,7 +696,6 @@
|
||||||
proc = conf.process,
|
proc = conf.process,
|
||||||
sliceAll = widget.slices = [],
|
sliceAll = widget.slices = [],
|
||||||
unitsName = settings.controller.units,
|
unitsName = settings.controller.units,
|
||||||
units = unitsName === 'in' ? 25.4 : 1,
|
|
||||||
roughToolDiam = getToolDiameter(conf, proc.camRoughTool),
|
roughToolDiam = getToolDiameter(conf, proc.camRoughTool),
|
||||||
outlineToolDiam = getToolDiameter(conf, proc.camOutlineTool),
|
outlineToolDiam = getToolDiameter(conf, proc.camOutlineTool),
|
||||||
contourToolDiam = getToolDiameter(conf, proc.camContourTool),
|
contourToolDiam = getToolDiameter(conf, proc.camContourTool),
|
||||||
|
|
@ -716,19 +714,19 @@
|
||||||
procTrace = proc.camTraceOn,
|
procTrace = proc.camTraceOn,
|
||||||
roughDown = procRough ? proc.camRoughDown : Infinity,
|
roughDown = procRough ? proc.camRoughDown : Infinity,
|
||||||
outlineDown = procOutline ? proc.camOutlineDown : Infinity,
|
outlineDown = procOutline ? proc.camOutlineDown : Infinity,
|
||||||
sliceDepth = Math.max(0.1, Math.min(roughDown, outlineDown) / 3 * units),
|
sliceDepth = Math.max(0.1, Math.min(roughDown, outlineDown) / 3),
|
||||||
addTabsOutline = procOutlineOn && proc.camTabsOn,
|
addTabsOutline = procOutlineOn && proc.camTabsOn,
|
||||||
tabWidth = proc.camTabsWidth * units,
|
tabWidth = proc.camTabsWidth,
|
||||||
tabHeight = proc.camTabsHeight * units,
|
tabHeight = proc.camTabsHeight,
|
||||||
bounds = widget.getBoundingBox(),
|
bounds = widget.getBoundingBox(),
|
||||||
mesh = widget.mesh,
|
mesh = widget.mesh,
|
||||||
zBottom = proc.camZBottom * units,
|
zBottom = proc.camZBottom,
|
||||||
zMin = Math.max(bounds.min.z, zBottom),
|
zMin = Math.max(bounds.min.z, zBottom),
|
||||||
zMax = bounds.max.z,
|
zMax = bounds.max.z,
|
||||||
zThru = zBottom === 0 ? (proc.camZThru || 0) * units : 0,
|
zThru = zBottom === 0 ? (proc.camZThru || 0) : 0,
|
||||||
ztOff = proc.camZTopOffset * units,
|
ztOff = proc.camZTopOffset,
|
||||||
camRoughStock = proc.camRoughStock * units,
|
camRoughStock = proc.camRoughStock,
|
||||||
camRoughDown = proc.camRoughDown * units,
|
camRoughDown = proc.camRoughDown,
|
||||||
minStepDown = Math.min(1, roughDown, outlineDown),
|
minStepDown = Math.min(1, roughDown, outlineDown),
|
||||||
maxToolDiam = 0,
|
maxToolDiam = 0,
|
||||||
sliceIndex = 0,
|
sliceIndex = 0,
|
||||||
|
|
@ -1154,13 +1152,12 @@
|
||||||
slices = widget.slices,
|
slices = widget.slices,
|
||||||
bounds = widget.getCamBounds(settings),
|
bounds = widget.getCamBounds(settings),
|
||||||
boundsz = bounds.max.z,
|
boundsz = bounds.max.z,
|
||||||
units = settings.controller.units === 'in' ? 25.4 : 1,
|
|
||||||
hasStock = process.camStockOffset || (process.camStockZ && process.camStockX && process.camStockY),
|
hasStock = process.camStockOffset || (process.camStockZ && process.camStockX && process.camStockY),
|
||||||
startCenter = process.outputOriginCenter,
|
startCenter = process.outputOriginCenter,
|
||||||
alignTop = settings.controller.alignTop,
|
alignTop = settings.controller.alignTop,
|
||||||
zclear = (process.camZClearance || 1) * units,
|
zclear = (process.camZClearance || 1),
|
||||||
zmax_outer = hasStock ? stock.z + zclear : outerz + zclear,
|
zmax_outer = hasStock ? stock.z + zclear : outerz + zclear,
|
||||||
ztOff = process.camZTopOffset * units,
|
ztOff = process.camZTopOffset,
|
||||||
zadd = hasStock ? stock.z - boundsz : alignTop ? outerz - boundsz : 0,
|
zadd = hasStock ? stock.z - boundsz : alignTop ? outerz - boundsz : 0,
|
||||||
zmax = outerz + zclear,
|
zmax = outerz + zclear,
|
||||||
wmpos = widget.mesh.position,
|
wmpos = widget.mesh.position,
|
||||||
|
|
@ -1173,9 +1170,9 @@
|
||||||
modes = CPRO,
|
modes = CPRO,
|
||||||
easeDown = process.camEaseDown,
|
easeDown = process.camEaseDown,
|
||||||
depthFirst = process.camDepthFirst,
|
depthFirst = process.camDepthFirst,
|
||||||
tolerance = process.camTolerance * units,
|
tolerance = process.camTolerance,
|
||||||
drillDown = process.camDrillDown * units,
|
drillDown = process.camDrillDown,
|
||||||
drillLift = process.camDrillLift * units,
|
drillLift = process.camDrillLift,
|
||||||
drillDwell = process.camDrillDwell,
|
drillDwell = process.camDrillDwell,
|
||||||
newOutput = widgetIndex === 0 ? [] : print.output,
|
newOutput = widgetIndex === 0 ? [] : print.output,
|
||||||
layerOut = [],
|
layerOut = [],
|
||||||
|
|
@ -1224,8 +1221,8 @@
|
||||||
}
|
}
|
||||||
lastTool = toolID;
|
lastTool = toolID;
|
||||||
}
|
}
|
||||||
feedRate = feed * units;
|
feedRate = feed;
|
||||||
plungeRate = plunge * units;
|
plungeRate = plunge;
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitDrills(polys) {
|
function emitDrills(polys) {
|
||||||
|
|
@ -1694,9 +1691,8 @@
|
||||||
bounds = widget.getCamBounds(settings),
|
bounds = widget.getCamBounds(settings),
|
||||||
dev = settings.device,
|
dev = settings.device,
|
||||||
spro = settings.process,
|
spro = settings.process,
|
||||||
units = settings.controller.units === 'in' ? 25.4 : 1,
|
maxZd = spro.camFastFeedZ,
|
||||||
maxZd = spro.camFastFeedZ * units,
|
maxXYd = spro.camFastFeed,
|
||||||
maxXYd = spro.camFastFeed * units,
|
|
||||||
decimals = BASE.config.gcode_decimals || 4,
|
decimals = BASE.config.gcode_decimals || 4,
|
||||||
pos = { x:null, y:null, z:null, f:null, t:null },
|
pos = { x:null, y:null, z:null, f:null, t:null },
|
||||||
line,
|
line,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue