diff --git a/src/kiri/mode/cam/cl-helical.js b/src/kiri/mode/cam/cl-helical.js index b3414ed0..f94183b1 100644 --- a/src/kiri/mode/cam/cl-helical.js +++ b/src/kiri/mode/cam/cl-helical.js @@ -1,16 +1,21 @@ import { api } from "../../core/api.js"; import { CAM } from "./driver-fe.js"; +import { clearPops, env } from "./client.js"; + + +let alert, lastWidget; + export let helicalOn = false; export function selectHelical() { if (helicalOn) { - return func.surfaceDone(); + return helicalDone(); } - func.clearPops(); + clearPops(); alert = api.show.alert("analyzing surfaces...", 1000); - let cylinders = poppedRec.cylinders; + let cylinders = env.poppedRec.cylinders; - CAM.surface_prep(currentIndex * RAD2DEG, () => { + CAM.surface_prep(true, () => { api.hide.alert(alert); alert = api.show.alert("[esc] cancels surface selection"); for (let [wid, arr] of Object.entries(cylinders)) { @@ -23,7 +28,7 @@ export function selectHelical() { } } }); - helicalOn = hoveredOp; + helicalOn = env.hoveredOp; helicalOn.classList.add("editing"); api.feature.on_mouse_up = (obj, ev) => { let { face } = obj; @@ -41,10 +46,10 @@ export function selectHelical() { }; export function helicalDone(){ - if (!(helicalOn && poppedRec && poppedRec.cylinders)) { + if (!(helicalOn && env.poppedRec && env.poppedRec.cylinders)) { return; } - let { cylinders } = poppedRec; + let { cylinders } = env.poppedRec; for (let wid of Object.keys(cylinders)) { let widget = api.widgets.forid(wid); if (widget) { diff --git a/src/kiri/mode/cam/cl-ops.js b/src/kiri/mode/cam/cl-ops.js index 0cf2721e..e8e75cf8 100644 --- a/src/kiri/mode/cam/cl-ops.js +++ b/src/kiri/mode/cam/cl-ops.js @@ -543,7 +543,7 @@ export function createPopOps() { rate: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toFloat, units:true}), feed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toFloat, units:true}), down: UC.newInput(LANG.ch_sdwn_s, {title:LANG.ch_sdwn_l, convert:UC.toFloat, units:true}), - startAng: UC.newInput(LANG.ch_stra_s, {title:LANG.ch_stra_l, convert:UC.toDegsFloat, bound:UC.bound(-360,360),show:() => poppedRec.forceStartAng}), + startAng: UC.newInput(LANG.ch_stra_s, {title:LANG.ch_stra_l, convert:UC.toDegsFloat, bound:UC.bound(-360,360),show:() => env.poppedRec.forceStartAng}), offOver: UC.newInput(LANG.cc_offd_s, {title:LANG.cc_offd_l, convert:UC.toFloat, units:true, bound:UC.bound(0,Infinity)}), sep: UC.newBlank({class:"pop-sep"}), forceStartAng: UC.newBoolean(LANG.ch_fsta_s, undefined, {title:LANG.ch_fsta_l, }), diff --git a/src/kiri/mode/cam/client.js b/src/kiri/mode/cam/client.js index d4c76855..d085e882 100644 --- a/src/kiri/mode/cam/client.js +++ b/src/kiri/mode/cam/client.js @@ -177,7 +177,7 @@ const opAddHelical = () => { surfaceDone(); let rec = env.popOp.helical.new(); rec.cylinders = { /* widget.id: [ faces... ] */ }; - func.opAdd(rec); + opAdd(rec); }; const opAddContour = (axis) => {