add drilling registration holes

This commit is contained in:
Stewart Allen 2020-07-16 22:03:30 -04:00
commit 00597333db
5 changed files with 53 additions and 2 deletions

View file

@ -429,6 +429,7 @@
camDrillDwell: 250, // drillDwell camDrillDwell: 250, // drillDwell
camDrillLift: 2, // drillLift camDrillLift: 2, // drillLift
camDrillingOn: false, // drillingOn camDrillingOn: false, // drillingOn
camDrillReg: "none",
camTabsAngle: 0, camTabsAngle: 0,
camTabsCount: 4, camTabsCount: 4,
camTabsWidth: 5, camTabsWidth: 5,

View file

@ -1404,6 +1404,8 @@
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}),
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"}),
camDrillReg: UC.newSelect(LANG.cd_regi_s, {modes:CAM, title:LANG.cd_regi_l}, "drillreg"),
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}),

View file

@ -142,6 +142,11 @@
{ name: "2", id: 2 }, { name: "2", id: 2 },
{ name: "4", id: 4 }, { name: "4", id: 4 },
{ name: "8", id: 8 } { name: "8", id: 8 }
],
drillreg: [
{ name: "none" },
{ name: "x axis" },
{ name: "y axis" }
] ]
}; };

View file

@ -58,7 +58,8 @@
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.camRough.marker.style.display = proc.camRoughOn ? 'flex' : 'none'; api.ui.camRough.marker.style.display = proc.camRoughOn ? 'flex' : 'none';
api.ui.camDrill.marker.style.display = proc.camDrillingOn ? 'flex' : 'none'; api.ui.camDrill.marker.style.display =
proc.camDrillingOn || proc.camDrillReg !== 'none' ? 'flex' : 'none';
api.ui.camOutline.marker.style.display = proc.camOutlineOn ? 'flex' : 'none'; api.ui.camOutline.marker.style.display = proc.camOutlineOn ? 'flex' : 'none';
api.ui.camContour.marker.style.display = api.ui.camContour.marker.style.display =
proc.camContourXOn || proc.camContourYOn ? 'flex' : 'none'; proc.camContourXOn || proc.camContourYOn ? 'flex' : 'none';
@ -859,6 +860,7 @@
procContourY = proc.camContourYOn && proc.camOutlinePlunge && contourToolDiam, procContourY = proc.camContourYOn && proc.camOutlinePlunge && contourToolDiam,
procContour = procContourX || procContourY, procContour = procContourX || procContourY,
procDrill = proc.camDrillingOn && proc.camDrillDown && proc.camDrillDownSpeed, procDrill = proc.camDrillingOn && proc.camDrillDown && proc.camDrillDownSpeed,
procDrillReg = proc.camDrillReg,
procTrace = proc.camTraceOn, procTrace = proc.camTraceOn,
sliceDepth = Math.max(0.1, Math.min(proc.camRoughDown, proc.camOutlineDown) / 3) * units, sliceDepth = Math.max(0.1, Math.min(proc.camRoughDown, proc.camOutlineDown) / 3) * units,
pocketOnlyRough = proc.camRoughPocket, pocketOnlyRough = proc.camRoughPocket,
@ -892,7 +894,7 @@
return ondone(`invalid slice depth (${sliceDepth.toFixed(2)} ${unitsName})`); return ondone(`invalid slice depth (${sliceDepth.toFixed(2)} ${unitsName})`);
} }
if (!(procFacing || procRough || procOutline || procContour || procDrill)) { if (!(procFacing || procRough || procOutline || procContour || procDrill || procDrillReg)) {
return ondone("no processes selected"); return ondone("no processes selected");
} }
@ -984,6 +986,10 @@
// set all default shells // set all default shells
const camShellPolys = shellRough = shellOutline = facePolys = camShell.gatherTopPolys([]); const camShellPolys = shellRough = shellOutline = facePolys = camShell.gatherTopPolys([]);
if (procDrillReg) {
sliceDrillReg(settings, widget, sliceAll);
}
if (procDrill) { if (procDrill) {
sliceDrill(settings, widget, slices, sliceAll); sliceDrill(settings, widget, slices, sliceAll);
} }
@ -1147,6 +1153,41 @@
}); });
} }
function sliceDrillReg(settings, widget, output) {
let proc = settings.process,
bounds = settings.bounds,
stock = settings.stock,
mx = (bounds.max.x + bounds.min.x) / 2,
my = (bounds.max.y + bounds.min.y) / 2,
dx = (stock.x - (bounds.max.x - bounds.min.x)) / 4,
dy = (stock.y - (bounds.max.y - bounds.min.y)) / 4,
dz = stock.z,
points = [];
switch(proc.camDrillReg) {
case "x axis":
points.push(newPoint(bounds.min.x - dx, my, 0));
points.push(newPoint(bounds.max.x + dx, my, 0));
break;
case "y axis":
points.push(newPoint(mx, bounds.min.y - dy, 0));
points.push(newPoint(mx, bounds.max.y + dy, 0));
break;
}
if (points.length) {
let slice = newSlice(0,null), polys = [];
points.forEach(point => {
polys.push(newPolygon()
.append(point.clone().setZ(bounds.max.z))
.append(point.clone().setZ(bounds.max.z - stock.z)));
});
slice.camMode = CPRO.DRILL;
slice.addTop(null).traces = polys;
output.append(slice);
}
}
// runs in browser main // runs in browser main
function sliceRender(widget) { function sliceRender(widget) {
let slices = widget.slices; let slices = widget.slices;

View file

@ -288,6 +288,8 @@ kiri.lang['en-us'] = {
cd_dwll_l: "dwell time\nbetween plunges in\nin milliseconds", cd_dwll_l: "dwell time\nbetween plunges in\nin milliseconds",
cd_lift_s: "drill lift", cd_lift_s: "drill lift",
cd_lift_l: "lift between plunges\nafter dwell period\nin workspace units\n0 to disable", cd_lift_l: "lift between plunges\nafter dwell period\nin workspace units\n0 to disable",
cd_regi_s: "register",
cd_regi_l: "drill registration holes\nfor double-sided parts\nindependent of enable\ndrilling but uses same\ntool and settings",
// CNC CUTOUT TABS // CNC CUTOUT TABS
ct_menu: "tabs", ct_menu: "tabs",