add negative chamfer hack for bottom-only gear chamfers
This commit is contained in:
parent
89e4e03700
commit
17581dbe7e
2 changed files with 11 additions and 3 deletions
|
|
@ -2133,6 +2133,13 @@ class Polygon {
|
|||
let z_side_top = z;
|
||||
let z_side_bottom = z_bottom;
|
||||
|
||||
console.log({ chamfer });
|
||||
|
||||
if (chamfer < 0) {
|
||||
chamfer_top = 0;
|
||||
chamfer_bottom = -chamfer;
|
||||
}
|
||||
|
||||
// create chamfers (when defined)
|
||||
if (chamfer_top) {
|
||||
let inset = this.offset(chamfer_top);
|
||||
|
|
@ -2149,11 +2156,12 @@ class Polygon {
|
|||
|
||||
if (chamfer_bottom) {
|
||||
let inset = this.offset(chamfer_bottom);
|
||||
console.log({ inset });
|
||||
if (inset.length === 1) {
|
||||
inset[0].setZ(0);
|
||||
bottom_face = inset[0].earcut();
|
||||
z_side_top -= chamfer_top;
|
||||
z_side_bottom += chamfer_top;
|
||||
z_side_top -= chamfer_top || chamfer_bottom;
|
||||
z_side_bottom += chamfer_bottom;
|
||||
let renest = POLY.renest([this.clone(true).setZ(z_side_bottom), inset[0]]);
|
||||
for (let rnpoly of renest) {
|
||||
obj.appendAll(rnpoly.ribbonMesh(false));
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ let add = {
|
|||
h.input({ value: opt.shaft || last.shaft || 5, size: 5, id: "_shaft" }),
|
||||
h.label('z height'),
|
||||
h.input({ value: opt.height || last.height || 15, size: 5, id: "_height" }),
|
||||
h.label('chamfer'),
|
||||
h.label({ _:'chamfer', title:"negative values apply chamfer to the bottom only" }),
|
||||
h.input({ value: opt.chamfer || last.chamfer || 0, size: 5, id: "_chamfer" }),
|
||||
h.hr(),
|
||||
h.code("all other settings must"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue