more code cleanup

This commit is contained in:
bakedpotatolord 2025-04-29 13:05:56 -06:00
commit 0284592a33
3 changed files with 6 additions and 22 deletions

View file

@ -1194,12 +1194,12 @@ CAM.init = function(kiri, api) {
alert = api.show.alert("[esc] cancels drill editing"); alert = api.show.alert("[esc] cancels drill editing");
kiri.api.widgets.opacity(0.8); kiri.api.widgets.opacity(0.8);
const widgets = kiri.api.widgets.all() const widgets = kiri.api.widgets.all()
/** /**
* creates a mesh for a hole and adds it to a widget * creates a mesh for a hole and adds it to a widget
* @param {Object3D} widget - widget to add the hole mesh to * @param {Object3D} widget - widget to add the hole mesh to
* @param {Object} drill - {depth,selected} object of the hole * @param {Object} drill - {depth,selected} object of the hole
* @returns {Mesh} the created mesh * @returns {Mesh} the created mesh
*/ */
function createHoleMesh(widget,drill){ function createHoleMesh(widget,drill){
let {depth,selected} = drill let {depth,selected} = drill
let color = selected ? 0xFF0000:0x39e366 let color = selected ? 0xFF0000:0x39e366
@ -1281,7 +1281,6 @@ CAM.init = function(kiri, api) {
if (!int) return; //if not a hole mesh return if (!int) return; //if not a hole mesh return
let { object } = int; let { object } = int;
func.selectHoleToggle(object); func.selectHoleToggle(object);
} }
/** /**
@ -1295,13 +1294,11 @@ CAM.init = function(kiri, api) {
mesh.material.color.setHex( hole.selected ? 0xFF0000:0x39e366 ); mesh.material.color.setHex( hole.selected ? 0xFF0000:0x39e366 );
} }
/************* ✨ Codeium Command ⭐ *************/
/** /**
* Clears the recorded holes in the widget (widget.drills array) * Clears the recorded holes in the widget (widget.drills array)
* and also clears the widget.adds array. * and also clears the widget.adds array.
* @param {Object} widget - the widget with the drills array to clear * @param {Object} widget - the widget with the drills array to clear
*/ */
/****** cda042f9-e5b8-4c32-acee-0ec915ea6a0a *******/
func.clearHolesRec = (widget)=>{ func.clearHolesRec = (widget)=>{
if(widget.drills){ if(widget.drills){
widget.drills.forEach(rec=>{ widget.drills.forEach(rec=>{
@ -1312,13 +1309,11 @@ CAM.init = function(kiri, api) {
} }
} }
/************* ✨ Codeium Command ⭐ *************/
/** /**
* Cleanup function for selectHoles. * Cleanup function for selectHoles.
* Removes all adds from the scene, hides the alert, and resets the opacity of the widgets. * Removes all adds from the scene, hides the alert, and resets the opacity of the widgets.
* Also resets the hover features and the editing class on the holeSelOn html element. * Also resets the hover features and the editing class on the holeSelOn html element.
*/ */
/****** 3ea6c195-e4a5-434f-98cf-4a587d441305 *******/
func.selectHolesDone = () => { func.selectHolesDone = () => {
if (!holeSelOn) { if (!holeSelOn) {
return; return;

View file

@ -1472,14 +1472,6 @@ class OpDrill extends CamOp {
updateToolDiams(drillToolDiam); updateToolDiams(drillToolDiam);
const allDrills = drills[widget.id] ?? [] const allDrills = drills[widget.id] ?? []
console.log("drills",allDrills)
console.log("op",op)
// for each slice, look for polygons with 98.5% circularity whose
// area is within the tolerance of a circle matching the tool diameter
// drill points to use center (average of all points) of the polygon // drill points to use center (average of all points) of the polygon
allDrills.forEach((drill)=> { allDrills.forEach((drill)=> {
if(!drill.selected){ if(!drill.selected){
@ -1489,7 +1481,6 @@ class OpDrill extends CamOp {
if (op.mark) { if (op.mark) {
// replace depth with single down peck // replace depth with single down peck
drill.depth = op.down drill.depth = op.down
} }
drill.zBottom = drill.z - drill.depth; drill.zBottom = drill.z - drill.depth;
@ -1515,7 +1506,6 @@ class OpDrill extends CamOp {
} }
prepare(ops, progress) { prepare(ops, progress) {
console.log("prepare drill",ops)
let { op, state } = this; let { op, state } = this;
let { settings, widget, addSlices, updateToolDiams } = state; let { settings, widget, addSlices, updateToolDiams } = state;
let { setTool, setSpindle, setDrill, emitDrills } = ops; let { setTool, setSpindle, setDrill, emitDrills } = ops;

View file

@ -195,7 +195,6 @@ function prepEach(widget, settings, print, firstPoint, update) {
} }
function emitDrills(polys) { function emitDrills(polys) {
console.log("emitDrills", polys);
polys = polys.slice(); polys = polys.slice();
for (;;) { for (;;) {
let closestDist = Infinity, let closestDist = Infinity,