update three.js. extract inner funcs from init. fix cache on windows. update clipper

This commit is contained in:
Stewart Allen 2020-03-16 23:57:14 -04:00
commit a13cdc309f
9 changed files with 8752 additions and 1125 deletions

View file

@ -104,7 +104,7 @@
THREE.Geometry.fromVertices = function(vertices) { THREE.Geometry.fromVertices = function(vertices) {
var geometry = new THREE.BufferGeometry(); var geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3)); geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
return geometry; return geometry;
}; };

7629
js/ext-clip2.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -50,382 +50,23 @@ var gs_kiri_init = exports;
return API.conf.get(); return API.conf.get();
} }
KIRI.init = function(api) { function checkSeed(then) {
// skip sample object load in onshape (or any script postload)
let assets = $('assets'), if (!SDB[SEED]) {
control = $('control'), SDB[SEED] = new Date().getTime();
container = $('container'), if (!SETUP.s) {
welcome = $('welcome'); platform.load_stl("/obj/cube.stl", function(vert) {
CATALOG.putFile("sample cube.stl", vert);
WIN.addEventListener("resize", API.dialog.update); platform.compute_max_z();
SPACE.view.home();
SPACE.showSkyGrid(false); setTimeout(API.space.save,500);
SPACE.setSkyColor(0xffffff); then();
SPACE.init(container, function (delta) { API.help.show();
if (API.var.layer_max === 0) return;
if (settings().controller.reverseZoom) delta = -delta;
if (delta > 0) API.var.layer_at--;
else if (delta < 0) API.var.layer_at++;
API.show.slices();
}); });
SPACE.platform.onMove(API.conf.save); return true;
SPACE.platform.setRound(true); }
}
Object.assign(UI, { return false;
// from static HTML
alert: {
dialog: $('alert-area'),
text: $('alert-text')
},
container: container,
assets: assets,
control: control,
ctrlLeft: $('control-left'),
ctrlRight: $('control-right'),
layerView: $('layer-view'),
layerSlider: $('layer-slider'),
modelOpacity: $('opacity'),
modal: $('modal'),
print: $('print'),
local: $('local'),
help: $('help'),
devices: $('devices'),
deviceAdd: $('device-add'),
deviceDelete: $('device-del'),
deviceSave: $('device-save'),
deviceClose: $('device-close'),
deviceSelect: $('device-select'),
deviceFavorites: $('device-favorites'),
deviceAll: $('device-all'),
tools: $('tools'),
toolsSave: $('tools-save'),
toolsClose: $('tools-close'),
toolSelect: $('tool-select'),
toolAdd: $('tool-add'),
toolDelete: $('tool-del'),
toolType: $('tool-type'),
toolName: $('tool-name'),
toolNum: $('tool-num'),
toolFluteDiam: $('tool-fdiam'),
toolFluteLen: $('tool-flen'),
toolShaftDiam: $('tool-sdiam'),
toolShaftLen: $('tool-slen'),
// toolTaperAngle: $('tool-tangle'),
toolTaperTip: $('tool-ttip'),
toolMetric: $('tool-metric'),
catalog: $('catalog'),
catalogBody: $('catalogBody'),
catalogList: $('catalogList'),
settings: $('settings'),
settingsBody: $('settingsBody'),
settingsList: $('settingsList'),
layerID: $('layer-id'),
layerSpan: $('layer-span'),
layerRange: $('layer-range'),
loading: $('loading').style,
progress: $('progress').style,
prostatus: $('prostatus'),
selection: $('selection'),
selWidth: $('sel_width'),
selHeight: $('sel_height'),
selDepth: $('sel_depth'),
scaleX: $('scale_x'),
scaleY: $('scale_y'),
scaleZ: $('scale_z'),
scaleUniform: $('scale_uni'),
stock: $('stock'),
stockWidth: $('stock-width'),
stockDepth: $('stock-width'),
stockHeight: $('stock-width'),
device: UC.newGroup(LANG.dv_gr_dev, $('device')),
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:20, text:true}),
setDeviceFilament: UC.newInput(LANG.dv_fila_s, {title:LANG.dv_fila_l, convert:UC.toFloat, modes:FDM}),
setDeviceNozzle: UC.newInput(LANG.dv_nozl_s, {title:LANG.dv_nozl_l, convert:UC.toFloat, modes:FDM}),
setDeviceWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toInt}),
setDeviceDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toInt}),
setDeviceHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toInt, modes:FDM}),
setDeviceMaxSpindle: UC.newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:UC.toInt, modes:CAM}),
setDeviceExtrusion: UC.newBoolean(LANG.dv_xtab_s, onBooleanClick, {title:LANG.dv_xtab_l}),
setDeviceOrigin: UC.newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l}),
setDeviceOriginTop: UC.newBoolean(LANG.dv_orgt_s, onBooleanClick, {title:LANG.dv_orgt_l, modes:CAM}),
setDeviceRound: UC.newBoolean(LANG.dv_bedc_s, onBooleanClick, {title:LANG.dv_bedc_l, modes:FDM}),
setDevice: UC.newGroup(LANG.dv_gr_gco, $('device')),
setDeviceFan: UC.newInput(LANG.dv_fanp_s, {title:LANG.dv_fanp_l, modes:FDM, size:17}),
setDeviceTrack: UC.newInput(LANG.dv_prog_s, {title:LANG.dv_prog_l, modes:FDM, size:17}),
setDeviceLayer: UC.newText(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, size:14, height: 2}),
setDeviceToken: UC.newBoolean(LANG.dv_tksp_s, null, {title:LANG.dv_tksp_l, modes:CAM_LASER}),
setDeviceStrip: UC.newBoolean(LANG.dv_strc_s, null, {title:LANG.dv_strc_l, modes:CAM}),
setDeviceFExt: UC.newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LASER, size:7}),
setDeviceDwell: UC.newText(LANG.dv_dwll_s, {title:LANG.dv_dwll_l, modes:CAM, size:14, height:2}),
setDeviceChange: UC.newText(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, size:14, height:2}),
setDeviceSpindle: UC.newText(LANG.dv_sspd_s, {title:LANG.dv_sspd_l, modes:CAM, size:14, height:2}),
setDevicePause: UC.newText(LANG.dv_paus_s, {title:LANG.dv_paus_l, modes:FDM, size:14, height:3}),
setDeviceLaserOn: UC.newText(LANG.dv_lzon_s, {title:LANG.dv_lzon_l, modes:LASER, size:14, height:3}),
setDeviceLaserOff: UC.newText(LANG.dv_lzof_s, {title:LANG.dv_lzof_l, modes:LASER, size:14, height:3}),
setDevicePre: UC.newText(LANG.dv_head_s, {title:LANG.dv_head_l, modes:ALL, size:14, height:3}),
setDevicePost: UC.newText(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:ALL, size:14, height:3}),
mode: UC.newGroup(LANG.mo_menu, assets),
modeTable: UC.newTableRow([
[
UI.modeFDM =
UC.newButton(LANG.mo_fdmp, function() { API.mode.set('FDM',null,platform.update_size) }),
],[
UI.modeLASER =
UC.newButton(LANG.mo_lazr, function() { API.mode.set('LASER',null,platform.update_size) }),
],[
UI.modeCAM =
UC.newButton(LANG.mo_cncm, function() { API.mode.set('CAM',null,platform.update_size) }, {id:"modeCAM"}),
]
]),
system: UC.newGroup(LANG.su_menu),
sysTable: UC.newTableRow([
[
UI.setupDevices =
UC.newButton(LANG.su_devi, showDevices)
],[
UI.setupTools =
UC.newButton(LANG.su_tool, showTools, {modes:CAM})
],[
UI.localButton =
UC.newButton(LANG.su_locl, API.show.local, {modes:FDM_CAM})
],[
UI.helpButton =
UC.newButton(LANG.su_help, API.help.show)
]
]),
wsFunc: UC.newGroup(LANG.fn_menu),
wsFuncTable: UC.newTableRow([
[
UI.load =
UC.newButton(LANG.fn_impo, function() { API.event.import() }),
UI.import =
UC.newButton("+")
],[
UI.modeArrange =
UC.newButton(LANG.fn_arra, platform.layout),
],[
UI.modeSlice =
UC.newButton(LANG.fn_slic, API.function.slice)
],[
UI.modePreview =
UC.newButton(LANG.fn_prev, API.function.print),
],[
UI.modeExport =
UC.newButton(LANG.fn_expo, API.function.export)
]
]),
camera: UC.newGroup(LANG.vu_menu),
camTable: UC.newTableRow([
[
UC.newButton(LANG.vu_home, SPACE.view.home),
UC.newButton(LANG.vu_rset, SPACE.view.reset)
],[
UC.newButton(LANG.vu_sptp, SPACE.view.top),
UC.newButton(LANG.vu_spfr, SPACE.view.front),
],[
UC.newButton(LANG.vu_splt, SPACE.view.left),
UC.newButton(LANG.vu_sprt, SPACE.view.right)
]
]),
workspace: UC.newGroup(LANG.ws_menu),
wsTable: UC.newTableRow([
[
UI.saveButton =
UC.newButton(LANG.ws_save, API.space.save),
],[
UC.newButton(LANG.ws_cler, API.space.clear)
]
]),
layout: UC.newGroup(LANG.op_menu),
showOrigin: UC.newBoolean(LANG.op_show_s, booleanSave, {title:LANG.op_show_l}),
alignTop: UC.newBoolean(LANG.op_alig_s, booleanSave, {title:LANG.op_alig_l, modes:CAM}),
autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}),
freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM}, "units"),
// allow modules to insert new items at the bottom of the left menu
appendLeft: UC.checkpoint(),
layers: UC.setGroup($("layers")),
layerOutline: UC.newBoolean(LANG.la_olin, onLayerToggle, {modes:LOCAL ? ALL : FDM_LASER}),
layerTrace: UC.newBoolean(LANG.la_trce, onLayerToggle, {modes:FDM_LASER}),
layerFacing: UC.newBoolean(LANG.la_face, onLayerToggle, {modes:CAM}),
layerRough: UC.newBoolean(LANG.la_ruff, onLayerToggle, {modes:CAM}),
layerFinish: UC.newBoolean(LANG.la_fini, onLayerToggle, {modes:CAM}),
layerFinishX: UC.newBoolean(LANG.la_finx, onLayerToggle, {modes:CAM}),
layerFinishY: UC.newBoolean(LANG.la_finy, onLayerToggle, {modes:CAM}),
layerDelta: UC.newBoolean(LANG.la_dlta, onLayerToggle, {modes:FDM}),
layerSolid: UC.newBoolean(LANG.la_slds, onLayerToggle, {modes:FDM}),
layerFill: UC.newBoolean(LANG.la_fill, onLayerToggle, {modes:FDM}),
layerSparse: UC.newBoolean(LANG.la_sprs, onLayerToggle, {modes:FDM}),
layerSupport: UC.newBoolean(LANG.la_sprt, onLayerToggle, {modes:FDM}),
layerPrint: UC.newBoolean(LANG.la_prnt, onLayerToggle),
layerMoves: UC.newBoolean(LANG.la_move, onLayerToggle),
settingsGroup: UC.newGroup(LANG.se_menu, control),
settingsTable: UC.newTableRow([
[
UI.settingsLoad =
UC.newButton(LANG.se_load, settingsLoad),
UI.settingsSave =
UC.newButton(LANG.se_save, settingsSave)
],[
UI.settingsExpert =
UC.newButton(LANG.se_xprt, () => { UC.setExpert(true); SDB.setItem('expert', true) }, {modes:FDM, expert: false}),
UI.settingsExpert =
UC.newButton(LANG.se_bsic, () => { UC.setExpert(false); SDB.removeItem('expert') }, {modes:FDM, expert:true})
]
]),
process: UC.newGroup(LANG.sl_menu, control, {modes:FDM_LASER}),
sliceHeight: UC.newInput(LANG.sl_lahi_s, {title:LANG.sl_lahi_l, convert:UC.toFloat, modes:FDM}),
sliceShells: UC.newInput(LANG.sl_shel_s, {title:LANG.sl_shel_l, convert:UC.toInt, modes:FDM}),
sliceTopLayers: UC.newInput(LANG.sl_ltop_s, {title:LANG.sl_ltop_l, convert:UC.toInt, modes:FDM}),
sliceSolidLayers: UC.newInput(LANG.sl_lsld_s, {title:LANG.sl_lsld_l, convert:UC.toInt, modes:FDM}),
sliceBottomLayers: UC.newInput(LANG.sl_lbot_s, {title:LANG.sl_lbot_l, convert:UC.toInt, modes:FDM}),
process: UC.newGroup(LANG.fi_menu, control, {modes:FDM}),
sliceFillType: UC.newSelect(LANG.fi_type, {modes:FDM}, "infill"),
sliceFillSparse: UC.newInput(LANG.fi_pcnt_s, {title:LANG.fi_pcnt_l, convert:UC.toFloat, bound:UC.bound(0.0,1.0), modes:FDM}),
sliceFillAngle: UC.newInput(LANG.fi_angl_s, {title:LANG.fi_angl_l, convert:UC.toFloat, modes:FDM, expert:true}),
sliceFillOverlap: UC.newInput(LANG.fi_over_s, {title:LANG.fi_over_l, convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM, expert:true}),
firstLayer: UC.newGroup(LANG.fl_menu, null, {modes:FDM}),
firstSliceHeight: UC.newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:UC.toFloat, modes:FDM}),
firstLayerRate: UC.newInput(LANG.fl_rate_s, {title:LANG.fl_rate_l, convert:UC.toFloat, modes:FDM}),
firstLayerFillRate: UC.newInput(LANG.fl_frat_s, {title:LANG.fl_frat_l, convert:UC.toFloat, modes:FDM}),
firstLayerPrintMult: UC.newInput(LANG.fl_mult_s, {title:LANG.fl_mult_l, convert:UC.toFloat, modes:FDM, expert:true}),
outputBrimCount: UC.newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:UC.toInt, modes:FDM}),
outputBrimOffset: UC.newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:UC.toFloat, modes:FDM}),
firstLayerNozzleTemp:UC.newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:UC.toInt, modes:FDM, expert:true}),
firstLayerBedTemp: UC.newInput(LANG.fl_bedd_s, {title:LANG.fl_bedd_l, convert:UC.toInt, modes:FDM, expert:true}),
support: UC.newGroup(LANG.sp_menu, null, {modes:FDM}),
sliceSupportDensity: UC.newInput(LANG.sp_dens_s, {title:LANG.sp_dens_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:FDM}),
sliceSupportSize: UC.newInput(LANG.sp_size_s, {title:LANG.sp_size_l, bound:UC.bound(1.0,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportOffset: UC.newInput(LANG.sp_offs_s, {title:LANG.sp_offs_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportGap: UC.newInput(LANG.sp_gaps_s, {title:LANG.sp_gaps_l, bound:UC.bound(0,5), convert:UC.toInt, modes:FDM, expert:true}),
sliceSupportSpan: UC.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportArea: UC.newInput(LANG.sp_area_s, {title:LANG.sp_area_l, bound:UC.bound(0.1,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportExtra: UC.newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, expert:true}),
sliceSupportEnable: UC.newBoolean(LANG.enable, onBooleanClick, {modes:FDM}),
laserOffset: UC.newInput(LANG.ls_offs_s, {title:LANG.ls_offs_l, convert:UC.toFloat, modes:LASER}),
laserSliceHeight: UC.newInput(LANG.ls_lahi_s, {title:LANG.ls_lahi_l, convert:UC.toFloat, modes:LASER}),
laserSliceSingle: UC.newBoolean(LANG.ls_sngl_s, onBooleanClick, {title:LANG.ls_sngl_l, modes:LASER}),
camCommon: UC.newGroup(LANG.cc_menu, null, {modes:CAM}),
camFastFeed: UC.newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:UC.toInt, modes:CAM}),
roughing: UC.newGroup(LANG.cr_menu, null, {modes:CAM}),
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}),
camPocketOnlyRough: UC.newBoolean(LANG.cc_pock_s, onBooleanClick, {title:LANG.cc_pock_l, modes:CAM}),
camEaseDown: UC.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}),
roughingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
finishing: UC.newGroup(LANG.cf_menu, null, {modes:CAM}),
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}),
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}),
finishCurvesOnly: UC.newBoolean(LANG.cf_curv_s, onBooleanClick, {title:LANG.cf_curv_l, modes:CAM}),
drilling: UC.newGroup(LANG.cd_menu, null, {modes:CAM}),
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}),
drillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
camTabs: UC.newGroup(LANG.ct_menu, null, {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}),
camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_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}),
camTabsOn: UC.newBoolean(LANG.enable, onBooleanClick, {title:LANG.ct_nabl_l, modes:CAM}),
output: UC.newGroup(LANG.fr_menu, null, {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}),
output: UC.newGroup(LANG.ou_menu),
outputTileSpacing: UC.newInput(LANG.ou_spac_c, {title:LANG.ou_spac_l, convert:UC.toInt, modes:LASER}),
outputTileScaling: UC.newInput(LANG.ou_scal_s, {title:LANG.ou_scal_l, convert:UC.toInt, bound:UC.bound(0.1,100), modes:LASER}),
outputLaserPower: UC.newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:UC.toInt, bound:UC.bound(1,100), modes:LASER}),
outputLaserSpeed: UC.newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:UC.toInt, modes:LASER}),
outputLaserMerged: UC.newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:LASER}),
outputLaserGroup: UC.newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, modes:LASER}),
outputTemp: UC.newInput(LANG.ou_nozl_s, {title:LANG.ou_nozl_l, convert:UC.toInt, modes:FDM}),
outputBedTemp: UC.newInput(LANG.ou_bedd_s, {title:LANG.ou_bedd_l, convert:UC.toInt, modes:FDM}),
outputFeedrate: UC.newInput(LANG.ou_feed_s, {title:LANG.ou_feed_l, convert:UC.toInt, modes:FDM}),
outputFinishrate: UC.newInput(LANG.ou_fini_s, {title:LANG.ou_fini_l, convert:UC.toInt, modes:FDM}),
outputSeekrate: UC.newInput(LANG.ou_move_s, {title:LANG.ou_move_l, convert:UC.toInt, modes:FDM}),
outputShellMult: UC.newInput(LANG.ou_shml_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}),
outputFanLayer: UC.newInput(LANG.ou_fanl_s, {title:LANG.ou_fanl_l, convert:UC.toInt, bound:UC.bound(0,100), modes:FDM, expert: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}),
camZTopOffset: UC.newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:UC.toFloat, modes:CAM}),
camZBottom: UC.newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:UC.toFloat, 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}),
outputClockwise: UC.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}),
camDepthFirst: UC.newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l, 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}),
camStockY: UC.newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_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}),
camStockOffset: UC.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
outputOriginBounds: UC.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
outputOriginCenter: UC.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:CAM_LASER}),
camOriginTop: UC.newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l, modes:CAM}),
advanced: UC.newGroup(LANG.ad_menu, null, {modes:FDM, expert:true}),
outputRetractDist: UC.newInput(LANG.ad_rdst_s, {title:LANG.ad_rdst_l, convert:UC.toFloat, modes:FDM, expert:true}),
outputRetractSpeed: UC.newInput(LANG.ad_rrat_s, {title:LANG.ad_rrat_l, convert:UC.toInt, modes:FDM, expert:true}),
outputRetractDwell: UC.newInput(LANG.ad_rdwl_s, {title:LANG.ad_rdwl_l, convert:UC.toInt, modes:FDM, expert:true}),
outputCoastDist: UC.newInput(LANG.ad_scst_s, {title:LANG.ad_scst_l, bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM, expert:true}),
// outputWipeDistance: UC.newInput("wipe", {title:"non-printing move at\close of polygon\nin millimeters", bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM, expert:true}),
sliceSolidMinArea: UC.newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:UC.toFloat, modes:FDM, expert:true}),
sliceMinHeight: UC.newInput(LANG.ad_minl_s, {title:LANG.ad_minl_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
outputMinSpeed: UC.newInput(LANG.ad_mins_s, {title:LANG.ad_mins_l, bound:UC.bound(5,200), convert:UC.toFloat, modes:FDM, expert:true}),
outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM, expert:true}),
zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}),
// detectThinWalls: UC.newBoolean("thin wall fill", onBooleanClick, {title: "detect and fill thin openings\nbetween shells walls", modes:FDM, expert:true})
polishLayers: LOCAL ? UC.newInput(LANG.ad_play_s, {title:LANG.ad_play_l, bound:UC.bound(0,10), convert:UC.toFloat, modes:FDM, expert:true}) : null,
polishSpeed: LOCAL ? UC.newInput(LANG.ad_pspd_s, {title:LANG.ad_pspd_l, bound:UC.bound(10,2000), convert:UC.toInt, modes:FDM, expert:true}) : null,
outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM, expert:true}),
gcodeVars: UC.newGroup(LANG.ag_menu, null, {modes:FDM, expert:true}),
gcodeNozzle: UC.newInput(LANG.ag_nozl_s, {title:LANG.ag_nozl_l, convert:UC.toInt, modes:FDM, expert:true}),
gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, expert:true})
});
function toolUpdate(a,b,c) {
DBUG.log(['toolUpdate',a,b,c])
} }
function booleanSave() { function booleanSave() {
@ -1416,6 +1057,382 @@ var gs_kiri_init = exports;
API.dialog.update(); API.dialog.update();
} }
// MAIN INITIALIZATION FUNCTION
function init_one() {
let assets = $('assets'),
control = $('control'),
container = $('container'),
welcome = $('welcome');
WIN.addEventListener("resize", API.dialog.update);
SPACE.showSkyGrid(false);
SPACE.setSkyColor(0xffffff);
SPACE.init(container, function (delta) {
if (API.var.layer_max === 0) return;
if (settings().controller.reverseZoom) delta = -delta;
if (delta > 0) API.var.layer_at--;
else if (delta < 0) API.var.layer_at++;
API.show.slices();
});
SPACE.platform.onMove(API.conf.save);
SPACE.platform.setRound(true);
Object.assign(UI, {
// from static HTML
alert: {
dialog: $('alert-area'),
text: $('alert-text')
},
container: container,
assets: assets,
control: control,
ctrlLeft: $('control-left'),
ctrlRight: $('control-right'),
layerView: $('layer-view'),
layerSlider: $('layer-slider'),
modelOpacity: $('opacity'),
modal: $('modal'),
print: $('print'),
local: $('local'),
help: $('help'),
devices: $('devices'),
deviceAdd: $('device-add'),
deviceDelete: $('device-del'),
deviceSave: $('device-save'),
deviceClose: $('device-close'),
deviceSelect: $('device-select'),
deviceFavorites: $('device-favorites'),
deviceAll: $('device-all'),
tools: $('tools'),
toolsSave: $('tools-save'),
toolsClose: $('tools-close'),
toolSelect: $('tool-select'),
toolAdd: $('tool-add'),
toolDelete: $('tool-del'),
toolType: $('tool-type'),
toolName: $('tool-name'),
toolNum: $('tool-num'),
toolFluteDiam: $('tool-fdiam'),
toolFluteLen: $('tool-flen'),
toolShaftDiam: $('tool-sdiam'),
toolShaftLen: $('tool-slen'),
// toolTaperAngle: $('tool-tangle'),
toolTaperTip: $('tool-ttip'),
toolMetric: $('tool-metric'),
catalog: $('catalog'),
catalogBody: $('catalogBody'),
catalogList: $('catalogList'),
settings: $('settings'),
settingsBody: $('settingsBody'),
settingsList: $('settingsList'),
layerID: $('layer-id'),
layerSpan: $('layer-span'),
layerRange: $('layer-range'),
loading: $('loading').style,
progress: $('progress').style,
prostatus: $('prostatus'),
selection: $('selection'),
selWidth: $('sel_width'),
selHeight: $('sel_height'),
selDepth: $('sel_depth'),
scaleX: $('scale_x'),
scaleY: $('scale_y'),
scaleZ: $('scale_z'),
scaleUniform: $('scale_uni'),
stock: $('stock'),
stockWidth: $('stock-width'),
stockDepth: $('stock-width'),
stockHeight: $('stock-width'),
device: UC.newGroup(LANG.dv_gr_dev, $('device')),
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:20, text:true}),
setDeviceFilament: UC.newInput(LANG.dv_fila_s, {title:LANG.dv_fila_l, convert:UC.toFloat, modes:FDM}),
setDeviceNozzle: UC.newInput(LANG.dv_nozl_s, {title:LANG.dv_nozl_l, convert:UC.toFloat, modes:FDM}),
setDeviceWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toInt}),
setDeviceDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toInt}),
setDeviceHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toInt, modes:FDM}),
setDeviceMaxSpindle: UC.newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:UC.toInt, modes:CAM}),
setDeviceExtrusion: UC.newBoolean(LANG.dv_xtab_s, onBooleanClick, {title:LANG.dv_xtab_l}),
setDeviceOrigin: UC.newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l}),
setDeviceOriginTop: UC.newBoolean(LANG.dv_orgt_s, onBooleanClick, {title:LANG.dv_orgt_l, modes:CAM}),
setDeviceRound: UC.newBoolean(LANG.dv_bedc_s, onBooleanClick, {title:LANG.dv_bedc_l, modes:FDM}),
setDevice: UC.newGroup(LANG.dv_gr_gco, $('device')),
setDeviceFan: UC.newInput(LANG.dv_fanp_s, {title:LANG.dv_fanp_l, modes:FDM, size:17}),
setDeviceTrack: UC.newInput(LANG.dv_prog_s, {title:LANG.dv_prog_l, modes:FDM, size:17}),
setDeviceLayer: UC.newText(LANG.dv_layr_s, {title:LANG.dv_layr_l, modes:FDM, size:14, height: 2}),
setDeviceToken: UC.newBoolean(LANG.dv_tksp_s, null, {title:LANG.dv_tksp_l, modes:CAM_LASER}),
setDeviceStrip: UC.newBoolean(LANG.dv_strc_s, null, {title:LANG.dv_strc_l, modes:CAM}),
setDeviceFExt: UC.newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LASER, size:7}),
setDeviceDwell: UC.newText(LANG.dv_dwll_s, {title:LANG.dv_dwll_l, modes:CAM, size:14, height:2}),
setDeviceChange: UC.newText(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, size:14, height:2}),
setDeviceSpindle: UC.newText(LANG.dv_sspd_s, {title:LANG.dv_sspd_l, modes:CAM, size:14, height:2}),
setDevicePause: UC.newText(LANG.dv_paus_s, {title:LANG.dv_paus_l, modes:FDM, size:14, height:3}),
setDeviceLaserOn: UC.newText(LANG.dv_lzon_s, {title:LANG.dv_lzon_l, modes:LASER, size:14, height:3}),
setDeviceLaserOff: UC.newText(LANG.dv_lzof_s, {title:LANG.dv_lzof_l, modes:LASER, size:14, height:3}),
setDevicePre: UC.newText(LANG.dv_head_s, {title:LANG.dv_head_l, modes:ALL, size:14, height:3}),
setDevicePost: UC.newText(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:ALL, size:14, height:3}),
mode: UC.newGroup(LANG.mo_menu, assets),
modeTable: UC.newTableRow([
[
UI.modeFDM =
UC.newButton(LANG.mo_fdmp, function() { API.mode.set('FDM',null,platform.update_size) }),
],[
UI.modeLASER =
UC.newButton(LANG.mo_lazr, function() { API.mode.set('LASER',null,platform.update_size) }),
],[
UI.modeCAM =
UC.newButton(LANG.mo_cncm, function() { API.mode.set('CAM',null,platform.update_size) }, {id:"modeCAM"}),
]
]),
system: UC.newGroup(LANG.su_menu),
sysTable: UC.newTableRow([
[
UI.setupDevices =
UC.newButton(LANG.su_devi, showDevices)
],[
UI.setupTools =
UC.newButton(LANG.su_tool, showTools, {modes:CAM})
],[
UI.localButton =
UC.newButton(LANG.su_locl, API.show.local, {modes:FDM_CAM})
],[
UI.helpButton =
UC.newButton(LANG.su_help, API.help.show)
]
]),
wsFunc: UC.newGroup(LANG.fn_menu),
wsFuncTable: UC.newTableRow([
[
UI.load =
UC.newButton(LANG.fn_impo, function() { API.event.import() }),
UI.import =
UC.newButton("+")
],[
UI.modeArrange =
UC.newButton(LANG.fn_arra, platform.layout),
],[
UI.modeSlice =
UC.newButton(LANG.fn_slic, API.function.slice)
],[
UI.modePreview =
UC.newButton(LANG.fn_prev, API.function.print),
],[
UI.modeExport =
UC.newButton(LANG.fn_expo, API.function.export)
]
]),
camera: UC.newGroup(LANG.vu_menu),
camTable: UC.newTableRow([
[
UC.newButton(LANG.vu_home, SPACE.view.home),
UC.newButton(LANG.vu_rset, SPACE.view.reset)
],[
UC.newButton(LANG.vu_sptp, SPACE.view.top),
UC.newButton(LANG.vu_spfr, SPACE.view.front),
],[
UC.newButton(LANG.vu_splt, SPACE.view.left),
UC.newButton(LANG.vu_sprt, SPACE.view.right)
]
]),
workspace: UC.newGroup(LANG.ws_menu),
wsTable: UC.newTableRow([
[
UI.saveButton =
UC.newButton(LANG.ws_save, API.space.save),
],[
UC.newButton(LANG.ws_cler, API.space.clear)
]
]),
layout: UC.newGroup(LANG.op_menu),
showOrigin: UC.newBoolean(LANG.op_show_s, booleanSave, {title:LANG.op_show_l}),
alignTop: UC.newBoolean(LANG.op_alig_s, booleanSave, {title:LANG.op_alig_l, modes:CAM}),
autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}),
freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM}, "units"),
// allow modules to insert new items at the bottom of the left menu
appendLeft: UC.checkpoint(),
layers: UC.setGroup($("layers")),
layerOutline: UC.newBoolean(LANG.la_olin, onLayerToggle, {modes:LOCAL ? ALL : FDM_LASER}),
layerTrace: UC.newBoolean(LANG.la_trce, onLayerToggle, {modes:FDM_LASER}),
layerFacing: UC.newBoolean(LANG.la_face, onLayerToggle, {modes:CAM}),
layerRough: UC.newBoolean(LANG.la_ruff, onLayerToggle, {modes:CAM}),
layerFinish: UC.newBoolean(LANG.la_fini, onLayerToggle, {modes:CAM}),
layerFinishX: UC.newBoolean(LANG.la_finx, onLayerToggle, {modes:CAM}),
layerFinishY: UC.newBoolean(LANG.la_finy, onLayerToggle, {modes:CAM}),
layerDelta: UC.newBoolean(LANG.la_dlta, onLayerToggle, {modes:FDM}),
layerSolid: UC.newBoolean(LANG.la_slds, onLayerToggle, {modes:FDM}),
layerFill: UC.newBoolean(LANG.la_fill, onLayerToggle, {modes:FDM}),
layerSparse: UC.newBoolean(LANG.la_sprs, onLayerToggle, {modes:FDM}),
layerSupport: UC.newBoolean(LANG.la_sprt, onLayerToggle, {modes:FDM}),
layerPrint: UC.newBoolean(LANG.la_prnt, onLayerToggle),
layerMoves: UC.newBoolean(LANG.la_move, onLayerToggle),
settingsGroup: UC.newGroup(LANG.se_menu, control),
settingsTable: UC.newTableRow([
[
UI.settingsLoad =
UC.newButton(LANG.se_load, settingsLoad),
UI.settingsSave =
UC.newButton(LANG.se_save, settingsSave)
],[
UI.settingsExpert =
UC.newButton(LANG.se_xprt, () => { UC.setExpert(true); SDB.setItem('expert', true) }, {modes:FDM, expert: false}),
UI.settingsExpert =
UC.newButton(LANG.se_bsic, () => { UC.setExpert(false); SDB.removeItem('expert') }, {modes:FDM, expert:true})
]
]),
process: UC.newGroup(LANG.sl_menu, control, {modes:FDM_LASER}),
sliceHeight: UC.newInput(LANG.sl_lahi_s, {title:LANG.sl_lahi_l, convert:UC.toFloat, modes:FDM}),
sliceShells: UC.newInput(LANG.sl_shel_s, {title:LANG.sl_shel_l, convert:UC.toInt, modes:FDM}),
sliceTopLayers: UC.newInput(LANG.sl_ltop_s, {title:LANG.sl_ltop_l, convert:UC.toInt, modes:FDM}),
sliceSolidLayers: UC.newInput(LANG.sl_lsld_s, {title:LANG.sl_lsld_l, convert:UC.toInt, modes:FDM}),
sliceBottomLayers: UC.newInput(LANG.sl_lbot_s, {title:LANG.sl_lbot_l, convert:UC.toInt, modes:FDM}),
process: UC.newGroup(LANG.fi_menu, control, {modes:FDM}),
sliceFillType: UC.newSelect(LANG.fi_type, {modes:FDM}, "infill"),
sliceFillSparse: UC.newInput(LANG.fi_pcnt_s, {title:LANG.fi_pcnt_l, convert:UC.toFloat, bound:UC.bound(0.0,1.0), modes:FDM}),
sliceFillAngle: UC.newInput(LANG.fi_angl_s, {title:LANG.fi_angl_l, convert:UC.toFloat, modes:FDM, expert:true}),
sliceFillOverlap: UC.newInput(LANG.fi_over_s, {title:LANG.fi_over_l, convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM, expert:true}),
firstLayer: UC.newGroup(LANG.fl_menu, null, {modes:FDM}),
firstSliceHeight: UC.newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:UC.toFloat, modes:FDM}),
firstLayerRate: UC.newInput(LANG.fl_rate_s, {title:LANG.fl_rate_l, convert:UC.toFloat, modes:FDM}),
firstLayerFillRate: UC.newInput(LANG.fl_frat_s, {title:LANG.fl_frat_l, convert:UC.toFloat, modes:FDM}),
firstLayerPrintMult: UC.newInput(LANG.fl_mult_s, {title:LANG.fl_mult_l, convert:UC.toFloat, modes:FDM, expert:true}),
outputBrimCount: UC.newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:UC.toInt, modes:FDM}),
outputBrimOffset: UC.newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:UC.toFloat, modes:FDM}),
firstLayerNozzleTemp:UC.newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:UC.toInt, modes:FDM, expert:true}),
firstLayerBedTemp: UC.newInput(LANG.fl_bedd_s, {title:LANG.fl_bedd_l, convert:UC.toInt, modes:FDM, expert:true}),
support: UC.newGroup(LANG.sp_menu, null, {modes:FDM}),
sliceSupportDensity: UC.newInput(LANG.sp_dens_s, {title:LANG.sp_dens_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:FDM}),
sliceSupportSize: UC.newInput(LANG.sp_size_s, {title:LANG.sp_size_l, bound:UC.bound(1.0,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportOffset: UC.newInput(LANG.sp_offs_s, {title:LANG.sp_offs_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportGap: UC.newInput(LANG.sp_gaps_s, {title:LANG.sp_gaps_l, bound:UC.bound(0,5), convert:UC.toInt, modes:FDM, expert:true}),
sliceSupportSpan: UC.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportArea: UC.newInput(LANG.sp_area_s, {title:LANG.sp_area_l, bound:UC.bound(0.1,200.0), convert:UC.toFloat, modes:FDM}),
sliceSupportExtra: UC.newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, expert:true}),
sliceSupportEnable: UC.newBoolean(LANG.enable, onBooleanClick, {modes:FDM}),
laserOffset: UC.newInput(LANG.ls_offs_s, {title:LANG.ls_offs_l, convert:UC.toFloat, modes:LASER}),
laserSliceHeight: UC.newInput(LANG.ls_lahi_s, {title:LANG.ls_lahi_l, convert:UC.toFloat, modes:LASER}),
laserSliceSingle: UC.newBoolean(LANG.ls_sngl_s, onBooleanClick, {title:LANG.ls_sngl_l, modes:LASER}),
camCommon: UC.newGroup(LANG.cc_menu, null, {modes:CAM}),
camFastFeed: UC.newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:UC.toInt, modes:CAM}),
roughing: UC.newGroup(LANG.cr_menu, null, {modes:CAM}),
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}),
camPocketOnlyRough: UC.newBoolean(LANG.cc_pock_s, onBooleanClick, {title:LANG.cc_pock_l, modes:CAM}),
camEaseDown: UC.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}),
roughingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
finishing: UC.newGroup(LANG.cf_menu, null, {modes:CAM}),
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}),
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}),
finishCurvesOnly: UC.newBoolean(LANG.cf_curv_s, onBooleanClick, {title:LANG.cf_curv_l, modes:CAM}),
drilling: UC.newGroup(LANG.cd_menu, null, {modes:CAM}),
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}),
drillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}),
camTabs: UC.newGroup(LANG.ct_menu, null, {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}),
camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_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}),
camTabsOn: UC.newBoolean(LANG.enable, onBooleanClick, {title:LANG.ct_nabl_l, modes:CAM}),
output: UC.newGroup(LANG.fr_menu, null, {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}),
output: UC.newGroup(LANG.ou_menu),
outputTileSpacing: UC.newInput(LANG.ou_spac_c, {title:LANG.ou_spac_l, convert:UC.toInt, modes:LASER}),
outputTileScaling: UC.newInput(LANG.ou_scal_s, {title:LANG.ou_scal_l, convert:UC.toInt, bound:UC.bound(0.1,100), modes:LASER}),
outputLaserPower: UC.newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:UC.toInt, bound:UC.bound(1,100), modes:LASER}),
outputLaserSpeed: UC.newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:UC.toInt, modes:LASER}),
outputLaserMerged: UC.newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:LASER}),
outputLaserGroup: UC.newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, modes:LASER}),
outputTemp: UC.newInput(LANG.ou_nozl_s, {title:LANG.ou_nozl_l, convert:UC.toInt, modes:FDM}),
outputBedTemp: UC.newInput(LANG.ou_bedd_s, {title:LANG.ou_bedd_l, convert:UC.toInt, modes:FDM}),
outputFeedrate: UC.newInput(LANG.ou_feed_s, {title:LANG.ou_feed_l, convert:UC.toInt, modes:FDM}),
outputFinishrate: UC.newInput(LANG.ou_fini_s, {title:LANG.ou_fini_l, convert:UC.toInt, modes:FDM}),
outputSeekrate: UC.newInput(LANG.ou_move_s, {title:LANG.ou_move_l, convert:UC.toInt, modes:FDM}),
outputShellMult: UC.newInput(LANG.ou_shml_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}),
outputFanLayer: UC.newInput(LANG.ou_fanl_s, {title:LANG.ou_fanl_l, convert:UC.toInt, bound:UC.bound(0,100), modes:FDM, expert: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}),
camZTopOffset: UC.newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:UC.toFloat, modes:CAM}),
camZBottom: UC.newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:UC.toFloat, 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}),
outputClockwise: UC.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}),
camDepthFirst: UC.newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l, 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}),
camStockY: UC.newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_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}),
camStockOffset: UC.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
outputOriginBounds: UC.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
outputOriginCenter: UC.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:CAM_LASER}),
camOriginTop: UC.newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l, modes:CAM}),
advanced: UC.newGroup(LANG.ad_menu, null, {modes:FDM, expert:true}),
outputRetractDist: UC.newInput(LANG.ad_rdst_s, {title:LANG.ad_rdst_l, convert:UC.toFloat, modes:FDM, expert:true}),
outputRetractSpeed: UC.newInput(LANG.ad_rrat_s, {title:LANG.ad_rrat_l, convert:UC.toInt, modes:FDM, expert:true}),
outputRetractDwell: UC.newInput(LANG.ad_rdwl_s, {title:LANG.ad_rdwl_l, convert:UC.toInt, modes:FDM, expert:true}),
outputCoastDist: UC.newInput(LANG.ad_scst_s, {title:LANG.ad_scst_l, bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM, expert:true}),
// outputWipeDistance: UC.newInput("wipe", {title:"non-printing move at\close of polygon\nin millimeters", bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM, expert:true}),
sliceSolidMinArea: UC.newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:UC.toFloat, modes:FDM, expert:true}),
sliceMinHeight: UC.newInput(LANG.ad_minl_s, {title:LANG.ad_minl_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
outputMinSpeed: UC.newInput(LANG.ad_mins_s, {title:LANG.ad_mins_l, bound:UC.bound(5,200), convert:UC.toFloat, modes:FDM, expert:true}),
outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM, expert:true}),
zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}),
// detectThinWalls: UC.newBoolean("thin wall fill", onBooleanClick, {title: "detect and fill thin openings\nbetween shells walls", modes:FDM, expert:true})
polishLayers: LOCAL ? UC.newInput(LANG.ad_play_s, {title:LANG.ad_play_l, bound:UC.bound(0,10), convert:UC.toFloat, modes:FDM, expert:true}) : null,
polishSpeed: LOCAL ? UC.newInput(LANG.ad_pspd_s, {title:LANG.ad_pspd_l, bound:UC.bound(10,2000), convert:UC.toInt, modes:FDM, expert:true}) : null,
outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM, expert:true}),
gcodeVars: UC.newGroup(LANG.ag_menu, null, {modes:FDM, expert:true}),
gcodeNozzle: UC.newInput(LANG.ag_nozl_s, {title:LANG.ag_nozl_l, convert:UC.toInt, modes:FDM, expert:true}),
gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, expert:true})
});
SPACE.addEventHandlers(self, [ SPACE.addEventHandlers(self, [
'keyup', keyUpHandler, 'keyup', keyUpHandler,
'keydown', keyDownHandler, 'keydown', keyDownHandler,
@ -1555,26 +1572,15 @@ var gs_kiri_init = exports;
} }
}); });
function checkSeed(ondone) { API.space.restore(init_two) || checkSeed(init_two) || init_two();
// skip sample object load in onshape (or any script postload)
if (!SDB[SEED]) {
SDB[SEED] = new Date().getTime();
if (!SETUP.s) {
platform.load_stl("/obj/cube.stl", function(vert) {
CATALOG.putFile("sample cube.stl", vert);
platform.compute_max_z();
SPACE.view.home();
setTimeout(API.space.save,500);
ondone();
API.help.show();
});
return true;
}
}
return false;
}
function ondone() { // extend API
API.show.devices = showDevices;
};
// SECOND STAGE INIT AFTER UI RESTORED
function init_two() {
let current = settings(); let current = settings();
platform.deselect(); platform.deselect();
@ -1674,10 +1680,7 @@ var gs_kiri_init = exports;
API.view.set(VIEWS.ARRANGE); API.view.set(VIEWS.ARRANGE);
} }
API.space.restore(ondone) || checkSeed(ondone) || ondone(); // schedule init_one to run after all page content is loaded
SPACE.addEventListener(DOC, 'DOMContentLoaded', init_one, false);
// extend API
API.show.devices = showDevices;
};
})(); })();

View file

@ -252,14 +252,14 @@ var gs_kiri_widget = exports;
*/ */
PRO.loadVertices = function(vertices) { PRO.loadVertices = function(vertices) {
if (this.mesh) { if (this.mesh) {
this.mesh.geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3)); this.mesh.geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
this.mesh.geometry.computeFaceNormals(); this.mesh.geometry.computeFaceNormals();
this.mesh.geometry.computeVertexNormals(); this.mesh.geometry.computeVertexNormals();
this.points = null; this.points = null;
return this; return this;
} else { } else {
var geometry = new THREE.BufferGeometry(); var geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3)); geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
return this.loadGeometry(geometry); return this.loadGeometry(geometry);
} }
}; };
@ -430,7 +430,7 @@ var gs_kiri_widget = exports;
this.bounds = null; this.bounds = null;
this.setWireframe(false); this.setWireframe(false);
this.clearSlices(); this.clearSlices();
mesh.geometry.applyMatrix(new THREE.Matrix4().makeScale(x, y, z)); mesh.geometry.applyMatrix4(new THREE.Matrix4().makeScale(x, y, z));
this.center(); this.center();
scale.x *= (x || 1.0); scale.x *= (x || 1.0);
scale.y *= (y || 1.0); scale.y *= (y || 1.0);
@ -447,7 +447,7 @@ var gs_kiri_widget = exports;
this.bounds = null; this.bounds = null;
this.setWireframe(false); this.setWireframe(false);
this.clearSlices(); this.clearSlices();
this.mesh.geometry.applyMatrix(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0))); this.mesh.geometry.applyMatrix4(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)));
this.center(); this.center();
let rot = this.orient.rot; let rot = this.orient.rot;
rot.x += (x || 0); rot.x += (x || 0);

View file

@ -19,8 +19,8 @@ if (debug) {
try { try {
[ [
"license", "license",
"ext-n3d", "ext-n3d", // for math/geometry only
"ext-clip", "ext-clip2",
"add-array", "add-array",
"add-three", "add-three",
"geo", "geo",

View file

@ -65,7 +65,7 @@ self.kiri.license = exports.LICENSE;
viewMode = VIEWS.ARRANGE, viewMode = VIEWS.ARRANGE,
layoutOnAdd = true, layoutOnAdd = true,
local = SETUP.local, local = SETUP.local,
mouseMoved = false, // mouseMoved = false,
camStock = null, camStock = null,
camTopZ = 0, camTopZ = 0,
topZ = 0, topZ = 0,
@ -199,10 +199,10 @@ self.kiri.license = exports.LICENSE;
set: setMode, set: setMode,
switch: switchMode switch: switchMode
}, },
mouse : { // mouse : {
moved : function() { return mouseMoved }, // moved : function() { return mouseMoved },
movedSet : function(b) { mouseMoved = b } // movedSet : function(b) { mouseMoved = b }
}, // },
opacity, opacity,
print: { print: {
get: function() { return currentPrint }, get: function() { return currentPrint },
@ -1814,14 +1814,12 @@ self.kiri.license = exports.LICENSE;
UI.ctrlRight.style.display = show ? 'block' : 'none'; UI.ctrlRight.style.display = show ? 'block' : 'none';
} }
SPACE.addEventListener(DOC, 'DOMContentLoaded', function () { KIRI.init() }, false);
SPACE.addEventListener(WIN, 'mousemove', function() { mouseMoved = true });
// prevent safari from exiting full screen mode // prevent safari from exiting full screen mode
DOC.onkeydown = function (evt) { if (evt.keyCode == 27) evt.preventDefault() } DOC.onkeydown = function (evt) { if (evt.keyCode == 27) evt.preventDefault() }
// run optional module functions // run optional module functions NOW before kiri-init has run
if (Array.isArray(self.kirimod)) { if (Array.isArray(self.kirimod)) {
kirimod.forEach(function(mod) { mod(kiri.api) }); kirimod.forEach(function(mod) { mod(kiri.api) });
} }
})(); })();

View file

@ -92,10 +92,7 @@ function lastmod(path) {
* @returns {*} * @returns {*}
*/ */
function getCachedFile(filePath, cpath, fn) { function getCachedFile(filePath, cpath, fn) {
let cachePath = ".cache/" + cpath let cachePath = ".cache/" + cpath.replace(/\//g,'_'),
.replace(/\//g,'_')
.replace(/\\/g,'_')
.replace(/:/g,'_'),
cached = fileCache[filePath], cached = fileCache[filePath],
now = time(); now = time();
@ -185,12 +182,9 @@ function concatCode(array) {
filepath; filepath;
array.forEach((file, index) => { array.forEach((file, index) => {
if (file.charAt(0) === "/" || file.indexOf(":\\") > 0) { if (file.charAt(0) === "/") {
filepath = file; filepath = file;
cachepath = "js_mod" + file cachepath = "js_mod" + file.replace(/\//g,'_');
.replace(/\//g,'_')
.replace(/\\/g,'_')
.replace(/:/g,'_');
array[index] = cachepath.substring(3).replace('.js',''); array[index] = cachepath.substring(3).replace('.js','');
fileMap[cachepath.replace("js_","js/")] = filepath; fileMap[cachepath.replace("js_","js/")] = filepath;
} else { } else {
@ -797,7 +791,7 @@ let ver = require('../js/license.js'),
script = { script = {
kiri : [ kiri : [
"license", "license",
"ext-clip", // "ext-clip2",
"ext-tween", "ext-tween",
"ext-fsave", "ext-fsave",
"add-array", "add-array",
@ -857,7 +851,7 @@ let ver = require('../js/license.js'),
work : [ work : [
"license", "license",
"ext-n3d", "ext-n3d",
"ext-clip", "ext-clip2",
"add-array", "add-array",
"add-three", "add-three",
"geo", "geo",

View file

@ -2,9 +2,10 @@
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix ## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
* `C` hide the bed with a checkbox? indication of part outside printable area? * `B` restore settings should restore all mode/device/settings
* `C` set page background color? or dark mode? * `C` set page background color? or dark mode?
* `C` better small screen support (on screen button for hiding side panels, compact selectors) * `C` better small screen support (on screen button for hiding side panels, compact selectors)
* `F` implement an in-app bug reporting system
* `F` widget general add-ons (fdm supports, cam tabs) * `F` widget general add-ons (fdm supports, cam tabs)
* `F` extend mesh object to store raw + annotations (rot,scale,pos) * `F` extend mesh object to store raw + annotations (rot,scale,pos)
* share raw data w/ dups, encode/decode * share raw data w/ dups, encode/decode
@ -39,12 +40,14 @@
# CAM # CAM
* `B` import scale off when units are NOT set to "mm"
* `B` fix zooming, workspace thickness for larger workspaces * `B` fix zooming, workspace thickness for larger workspaces
* `B` fails in pancaking (clone) when there are no sliced layers (like z bottom too high) * `B` fails in pancaking (clone) when there are no sliced layers (like z bottom too high)
* `B` outside cutting direction in roughing mode inverted
* `F` send gcode to cncjs
* `F` trapezoidal tabs (in the Z axis) * `F` trapezoidal tabs (in the Z axis)
* `F` lead-in milling * `F` lead-in milling
* `F` ease-in and ease-out especially on tab cut-out start/stop * `F` ease-in and ease-out especially on tab cut-out start/stop
* `F` implement z line-only follows for ball/taper
* `F` add option to spiral in vs out (optimal tool life) vs mixed (optimal path) * `F` add option to spiral in vs out (optimal tool life) vs mixed (optimal path)
* `F` add endmill spiral direction to fully respect climb vs conventional * `F` add endmill spiral direction to fully respect climb vs conventional
* `F` add tapered ball mills * `F` add tapered ball mills

View file

@ -37,7 +37,7 @@
"n3d-threejs": "^72.0.0", "n3d-threejs": "^72.0.0",
"pixi.js": "^4.8.9", "pixi.js": "^4.8.9",
"serve-static": "^1.14.1", "serve-static": "^1.14.1",
"three": "^0.96.0", "three": "^0.114.0",
"tween.js": "^0.14.0", "tween.js": "^0.14.0",
"uglify-es": "^3.3.10", "uglify-es": "^3.3.10",
"validator": "^8.2.0", "validator": "^8.2.0",