Merge branch 'rel-4.1'

This commit is contained in:
Stewart Allen 2025-06-22 15:17:41 -04:00
commit 979458026b
5 changed files with 18 additions and 12 deletions

View file

@ -1266,7 +1266,7 @@ CAM.init = function(kiri, api) {
centers = centers ?? []
// list of all hole centers and if they are selected
kiri.api.widgets.for(widget => {
const {holes} = centers.find(center=>center.id = widget.id)
const {holes} = centers.find(center=>center.id == widget.id)
// console.log(holes)
if (!holes.length) unselectHoles(holes);
holes.forEach(hole => {
@ -1791,7 +1791,7 @@ CAM.init = function(kiri, api) {
menu: UC.newRow([ UC.newButton("select", func.surfaceAdd) ], {class:"ext-buttons f-row"}),
};
const drillOp =createPopOp('drill', {
createPopOp('drill', {
tool: 'camDrillTool',
spindle: 'camDrillSpindle',
down: 'camDrillDown',
@ -1801,7 +1801,7 @@ CAM.init = function(kiri, api) {
mark: 'camDrillMark',
precision:'camDrillPrecision',
thru: 'camDrillThru',
fromTop: 'camDrillFromStockTop',
}).inputs = {
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
sep: UC.newBlank({class:"pop-sep"}),
@ -1810,7 +1810,8 @@ CAM.init = function(kiri, api) {
down: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, units:true}),
dwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_l, convert:UC.toFloat}),
lift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, units:true, show:() => !poppedRec.mark}),
mark: UC.newBoolean(LANG.cd_mark_s, undefined, {title:LANG.cd_mark_l}),
mark: UC.newBoolean(LANG.cd_mark_s,undefined, {title:LANG.cd_mark_l, show:() => !poppedRec.fromTop}),
fromTop: UC.newBoolean(LANG.cd_ftop_s,undefined, {title:LANG.cd_ftop_l, show:() => !poppedRec.mark}),
sep: UC.newBlank({class:"pop-sep"}),
thru: UC.newInput(LANG.cd_dtru_s, {title:LANG.cd_dtru_l, convert:UC.toFloat, units:true,show:() => !poppedRec.mark}),
precision:UC.newInput(LANG.cd_prcn_s, {title:LANG.cd_prcn_l, convert:UC.toFloat, units:true,show:() => !poppedRec.mark}),

View file

@ -200,9 +200,6 @@ class OpRough extends CamOp {
POLY.offset([ newPolygon().centerRectangle(stock.center, stock.x, stock.y) ], step) :
POLY.offset(shadow, roughIn ? step : step + roughLeave + toolDiam / 2);
let facing = POLY.offset(inset, -step, { count: 999, flat: true });
if (isIndexed) {
ztOff = (stock.z / 2) - zMax;
}
let zdiv = ztOff / roughDown;
let zstep = (zdiv % 1 > 0) ? ztOff / (Math.floor(zdiv) + 1) : roughDown;
if (ztOff === 0) {

View file

@ -52,8 +52,8 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
track = widget.track;
({ camZTop, camZBottom, camZThru } = proc);
wztop = track.top;
ztOff = isIndexed ? 0 : (stock.z - wztop);
zbOff = isIndexed ? 0 : (wztop - track.box.d);
ztOff = isIndexed ? (stock.z - bounds.dim.z) / 2 : (stock.z - wztop);
zbOff = isIndexed ? (stock.z - bounds.dim.z) / 2 : (wztop - track.box.d);
zBottom = isIndexed ? camZBottom : camZBottom - zbOff;
zMin = isIndexed ? bounds.min.z : Math.max(bounds.min.z, zBottom);
zMax = bounds.max.z;
@ -125,7 +125,7 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
return error('no processes specified');
}
if (stock.x && stock.y && stock.z) {
if (stock.x && stock.y && stock.z && !isIndexed) {
if (stock.x + 0.00001 < bounds.max.x - bounds.min.x) {
return error('stock X too small for part. resize stock or use offset stock');
}
@ -291,7 +291,7 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
if (op.op.type === "index") {
widget.topo = undefined;
// let points = base.verticesToPoints();
state.slicer = new kiri.cam_slicer(widget);
slicer = state.slicer = new kiri.cam_slicer(widget);
shadows = {};
await new CAM.OPS.shadow(state, { type: "shadow", silent: true }).slice(progress => {
// console.log('reshadow', progress.round(3));
@ -471,7 +471,7 @@ CAM.holes = async function(settings, widget, individual, rec,onProgress) {
let slicerOpts = {flatoff: 0.001}
let slicer = new kiri.cam_slicer(widget,slicerOpts);
let zFlats = Object.keys(slicer.zFlat).map(Number).map(z=>[z,z-0.002]).flat()
precision = Math.max( 0, precision )
let intervals = (precision == 0) ? [] : slicer.interval(
precision,
@ -564,6 +564,11 @@ CAM.holes = async function(settings, widget, individual, rec,onProgress) {
onProgress(0.75+(i/circles.length*0.25),"assemble holes")
}
drills.forEach( h=>{
if(rec.fromTop){
// set z top if selected
h.depth += wztop - h.z
h.z = wztop
}
delete h.overlapping //for encoding
h.diam = toolDiam // for mesh generation
h.selected = (!individual && Math.abs(h.area - area) <= area * 0.05 ); //for same size selection

View file

@ -520,6 +520,7 @@ const conf = exports({
camDrillDwell: 250,
camDrillLift: 2,
camDrillMark: false,
camDrillFromStockTop: false,
camDrillThru: 5,
camDrillPrecision: 1,
camDrillingOn: false,

View file

@ -599,6 +599,8 @@ self.kiri.lang['en-us'] = {
cd_dtru_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"],
cd_ftop_s: "from stock top",
cd_ftop_l: ["drill from stock top","instead of part surface"],
cd_prcn_s: "precision",
cd_prcn_l: ["distance between slices","to search for holes","in workspace units","lower is slower and","uses more memory","0 = only flats"],