add contour bridging option, tab color/opacity update on light/dark change
This commit is contained in:
parent
bcc64baef8
commit
66da2789b2
5 changed files with 40 additions and 5 deletions
|
|
@ -139,6 +139,11 @@ CAM.init = function(kiri, api) {
|
||||||
"selection.rotate"
|
"selection.rotate"
|
||||||
], updateStock);
|
], updateStock);
|
||||||
|
|
||||||
|
api.event.on([
|
||||||
|
// update tab color/opacity on dark/light change
|
||||||
|
"boolean.update"
|
||||||
|
], updateTabs);
|
||||||
|
|
||||||
api.event.on("preview.end", () => {
|
api.event.on("preview.end", () => {
|
||||||
isParsed = false;
|
isParsed = false;
|
||||||
if (isCamMode && camStock) {
|
if (isCamMode && camStock) {
|
||||||
|
|
@ -997,6 +1002,7 @@ CAM.init = function(kiri, api) {
|
||||||
angle: 'camContourAngle',
|
angle: 'camContourAngle',
|
||||||
tolerance: 'camTolerance',
|
tolerance: 'camTolerance',
|
||||||
flatness: 'camFlatness',
|
flatness: 'camFlatness',
|
||||||
|
bridging: 'camContourBridge',
|
||||||
curves: 'camContourCurves',
|
curves: 'camContourCurves',
|
||||||
inside: 'camContourIn',
|
inside: 'camContourIn',
|
||||||
axis: 'X'
|
axis: 'X'
|
||||||
|
|
@ -1008,8 +1014,10 @@ CAM.init = function(kiri, api) {
|
||||||
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0)}),
|
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0)}),
|
||||||
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
||||||
angle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90)}),
|
angle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90)}),
|
||||||
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
flatness: UC.newInput(LANG.ou_flat_s, {title:LANG.ou_flat_l, convert:UC.toFloat, bound:UC.bound(0,1.0), units:true, round:4}),
|
flatness: UC.newInput(LANG.ou_flat_s, {title:LANG.ou_flat_l, convert:UC.toFloat, bound:UC.bound(0,1.0), units:true, round:4}),
|
||||||
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true, round:4}),
|
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true, round:4}),
|
||||||
|
bridging: UC.newInput(LANG.ou_brdg_s, {title:LANG.ou_brdg_l, convert:UC.toFloat, bound:UC.bound(0,1000.0), units:true, round:4, show:(op) => op.inputs.curves.checked}),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
|
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
|
||||||
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l})
|
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l})
|
||||||
|
|
@ -1187,7 +1195,7 @@ function createTabBox(iw, ic, n) {
|
||||||
const rot = new THREE.Quaternion().setFromAxisAngle(zaxis, Math.atan2(n.y, n.x));
|
const rot = new THREE.Quaternion().setFromAxisAngle(zaxis, Math.atan2(n.y, n.x));
|
||||||
const pos = { x:ic.x, y:ic.y, z:ic.z };
|
const pos = { x:ic.x, y:ic.y, z:ic.z };
|
||||||
const dim = { x:camTabsDepth, y:camTabsWidth, z:camTabsHeight };
|
const dim = { x:camTabsDepth, y:camTabsWidth, z:camTabsHeight };
|
||||||
const tab = addbox(pos, 0x0000dd, 'tabb', dim, { rotate: rot });
|
const tab = addbox(pos, boxColor(), 'tabb', dim, { rotate: rot, opacity: boxOpacity() });
|
||||||
return { pos, dim, rot, tab, width: camTabsWidth, height: camTabsHeight };
|
return { pos, dim, rot, tab, width: camTabsWidth, height: camTabsHeight };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1197,8 +1205,8 @@ function addWidgetTab(widget, rec) {
|
||||||
// prevent duplicate restore from repeated settings load calls
|
// prevent duplicate restore from repeated settings load calls
|
||||||
if (!tabs[id]) {
|
if (!tabs[id]) {
|
||||||
pos.box = addbox(
|
pos.box = addbox(
|
||||||
pos, 0x0000dd, id,
|
pos, boxColor(), id,
|
||||||
dim, { group: widget.mesh, rotate: rot }
|
dim, { group: widget.mesh, rotate: rot, opacity: boxOpacity() }
|
||||||
);
|
);
|
||||||
pos.box.tab = Object.assign({widget, id}, pos);
|
pos.box.tab = Object.assign({widget, id}, pos);
|
||||||
widget.adds.push(pos.box);
|
widget.adds.push(pos.box);
|
||||||
|
|
@ -1228,6 +1236,18 @@ function clearTabs(widget, skiprec) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateTabs() {
|
||||||
|
// update tab color and opacity
|
||||||
|
API.widgets.all().forEach(widget => {
|
||||||
|
Object.values(widget.tabs || {}).forEach(rec => {
|
||||||
|
for (let rec of widget.adds || []) {
|
||||||
|
rec.material.color = new THREE.Color(boxColor());
|
||||||
|
rec.material.opacity = boxOpacity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function unselectTraces(widget, skip) {
|
function unselectTraces(widget, skip) {
|
||||||
if (widget.trace_stack) {
|
if (widget.trace_stack) {
|
||||||
widget.trace_stack.meshes.forEach(mesh => {
|
widget.trace_stack.meshes.forEach(mesh => {
|
||||||
|
|
@ -1256,8 +1276,17 @@ function validateTools(tools) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addbox() { return FDM.addbox(...arguments)};
|
function addbox() { return FDM.addbox(...arguments)};
|
||||||
|
|
||||||
function delbox() { return FDM.delbox(...arguments)};
|
function delbox() { return FDM.delbox(...arguments)};
|
||||||
|
|
||||||
|
function boxColor() {
|
||||||
|
return API.space.is_dark() ? 0x00ddff : 0x0000dd;
|
||||||
|
}
|
||||||
|
|
||||||
|
function boxOpacity() {
|
||||||
|
return API.space.is_dark() ? 0.75 : 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
isAnimate = true;
|
isAnimate = true;
|
||||||
API.widgets.opacity(isParsed ? 0 : 0.75);
|
API.widgets.opacity(isParsed ? 0 : 0.75);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class Topo {
|
||||||
bounds = widget.getBoundingBox().clone(),
|
bounds = widget.getBoundingBox().clone(),
|
||||||
tolerance = contour.tolerance,
|
tolerance = contour.tolerance,
|
||||||
flatness = contour.flatness || 0.005,
|
flatness = contour.flatness || 0.005,
|
||||||
|
bridge = contour.bridging || 10,
|
||||||
proc = settings.process,
|
proc = settings.process,
|
||||||
shadow = tshadow,
|
shadow = tshadow,
|
||||||
minX = bounds.min.x,
|
minX = bounds.min.x,
|
||||||
|
|
@ -148,7 +149,9 @@ class Topo {
|
||||||
// todo: merge co-linear, not just co-planar
|
// todo: merge co-linear, not just co-planar
|
||||||
if (lastP && Math.abs(lastP.z - z) < flatness) {
|
if (lastP && Math.abs(lastP.z - z) < flatness) {
|
||||||
if (curvesOnly) {
|
if (curvesOnly) {
|
||||||
end_poly();
|
if ((newtrace.last() || lastP).distTo2D(newP) >= bridge) {
|
||||||
|
end_poly();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
latent = newP;
|
latent = newP;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -665,7 +665,7 @@ function addbox(point, color, name, dim = {x:1,y:1,z:1,rz:0}, opt = {}) {
|
||||||
new BoxGeometry(dim.x, dim.y, dim.z),
|
new BoxGeometry(dim.x, dim.y, dim.z),
|
||||||
new MeshPhongMaterial({
|
new MeshPhongMaterial({
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.5,
|
opacity: opt.opacity || 0.5,
|
||||||
color
|
color
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -534,6 +534,7 @@ const conf = exports({
|
||||||
camFastFeedZ: 300,
|
camFastFeedZ: 300,
|
||||||
camTolerance: 0,
|
camTolerance: 0,
|
||||||
camFlatness: 0.001,
|
camFlatness: 0.001,
|
||||||
|
camContourBridge: 10,
|
||||||
camStockX: 5,
|
camStockX: 5,
|
||||||
camStockY: 5,
|
camStockY: 5,
|
||||||
camStockZ: 0,
|
camStockZ: 0,
|
||||||
|
|
|
||||||
|
|
@ -600,6 +600,8 @@ self.kiri.lang['en-us'] = {
|
||||||
ou_toll_l: ["surface precision","in workspace units","lower is slower and","uses more memory","0 = automatic based","on animate preference"],
|
ou_toll_l: ["surface precision","in workspace units","lower is slower and","uses more memory","0 = automatic based","on animate preference"],
|
||||||
ou_flat_s: "flatness",
|
ou_flat_s: "flatness",
|
||||||
ou_flat_l: ["delta z below which two adjacent","points are considered co-linear"],
|
ou_flat_l: ["delta z below which two adjacent","points are considered co-linear"],
|
||||||
|
ou_brdg_s: "bridging",
|
||||||
|
ou_brdg_l: ["flat distance between curved","areas to bridge with a cut"],
|
||||||
ou_zanc_s: "z anchor",
|
ou_zanc_s: "z anchor",
|
||||||
ou_zanc_l: ["controls the position of the part","when stock Z exceeds part Z"],
|
ou_zanc_l: ["controls the position of the part","when stock Z exceeds part Z"],
|
||||||
ou_ztof_s: "z offset",
|
ou_ztof_s: "z offset",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue