implement drill-through

This commit is contained in:
bakedpotatolord 2025-04-21 12:24:41 -06:00
commit 7bee55b9c7
3 changed files with 19 additions and 7 deletions

View file

@ -1157,6 +1157,16 @@ CAM.init = function(kiri, api) {
API.conf.save();
};
func.selectIndividualHoles = function(){
console.log("func.selectIndividualHoles not implemented");
}
func.selectAllHoles= function(){
console.log("func.selectAllHoles not implemented");
}
// COMMON TAB/TRACE EVENT HANDLERS
api.event.on("slice.begin", () => {
if (isCamMode) {
@ -1598,8 +1608,8 @@ CAM.init = function(kiri, api) {
thru: UC.newInput(LANG.cd_drlthru_s, {title:LANG.cd_drlthru_l, convert:UC.toFloat, units:true}),
sep: UC.newBlank({class:"pop-sep"}),
actions: UC.newRow([
UC.newButton(LANG.cd_select_s, func.selectIndividual, {title:LANG.cd_select_l}),
UC.newButton(LANG.cd_selall_s, func.selectAll, {title:LANG.cd_selall_l})
UC.newButton(LANG.cd_select_s, func.selectIndividualHoles, {title:LANG.cd_select_l}),
UC.newButton(LANG.cd_selall_s, func.selectAllHoles, {title:LANG.cd_selall_l})
], {class:"ext-buttons f-row"})
};

View file

@ -1484,9 +1484,9 @@ class OpDrill extends CamOp {
for (let poly of inner) {
if (poly.circularity() >= 0.985 && Math.abs(poly.area() - area) <= areaDelta) {
let center = poly.calcCircleCenter(),
merged = false,
closest = Infinity,
dist;
merged = false,
closest = Infinity,
dist;
// TODO reject if inside camShellPolys (means there is material above)
if (center.isInPolygon(slice.shadow)) {
continue;
@ -1532,7 +1532,9 @@ class OpDrill extends CamOp {
point.y = center.y;
});
// for thru holes, follow z thru when set
if (zThru && center.isInPolygon(thruHoles)) {
if ((op.thru>0) && center.isInPolygon(thruHoles)) {
drill.points.push(drill.points.last().sub({x:0,y:0,z:op.thru}));
}else if(zThru && center.isInPolygon(thruHoles)){
drill.points.push(drill.points.last().sub({x:0,y:0,z:zThru}));
}
slice.camLines = [ drill ];

View file

@ -596,7 +596,7 @@ self.kiri.lang['en-us'] = {
cd_thru_s: "z extend",
cd_thru_l: ["extend downward cut through stock","in workspace units"],
cd_drlthru_s: "drill through",
cd_drlthru_l: ["additional drill depth below part bottom"],
cd_drlthru_l: ["additional drill depth below part bottom","overrides global z thru","0 to disable"],
cd_mark_s: "marking",
cd_mark_l: ["only mark holes, do not drill out","the step down setting is used","to determine how deep to mark"],