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

View file

@ -1472,14 +1472,6 @@ class OpDrill extends CamOp {
updateToolDiams(drillToolDiam);
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
allDrills.forEach((drill)=> {
if(!drill.selected){
@ -1489,7 +1481,6 @@ class OpDrill extends CamOp {
if (op.mark) {
// replace depth with single down peck
drill.depth = op.down
}
drill.zBottom = drill.z - drill.depth;
@ -1515,7 +1506,6 @@ class OpDrill extends CamOp {
}
prepare(ops, progress) {
console.log("prepare drill",ops)
let { op, state } = this;
let { settings, widget, addSlices, updateToolDiams } = state;
let { setTool, setSpindle, setDrill, emitDrills } = ops;

View file

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