fix gear shaft diam, log gear pitch when created

This commit is contained in:
Stewart Allen 2024-07-19 00:55:05 -04:00
commit 9106d8ad21
4 changed files with 8 additions and 4 deletions

View file

@ -347,7 +347,7 @@ let add = {
h.label('twist angle'),
h.input({ value: opt.twist || 0, size: 5, id: "gtwist" }),
h.label('shaft diameter'),
h.input({ value: opt.shaft || 10, size: 5, id: "gshaft" }),
h.input({ value: opt.shaft || 5, size: 5, id: "gshaft" }),
h.button({ _: "create", onclick() {
gengear(
api.modal.bound.gteeth.value,

View file

@ -118,7 +118,7 @@ const modal = api.modal = {
let pinner;
// transient logging window bottom/left
const log = api.log = {
age: 10000, // age out lines more than 10 seconds old
age: 600000, // age out lines more than 10 minutes old
data: [], // last n messages
@ -187,7 +187,9 @@ const log = api.log = {
};
// bind endpoint for worker to log in the ui
gapp.broker.subscribe("mesh.log", log.emit);
gapp.broker.subscribe("mesh.log", msg => {
log.emit(msg);
});
// welcome dialog
api.welcome = function(version = "unknown") {

View file

@ -813,6 +813,8 @@ mesh.tool = class MeshTool {
for (var i = 0; i < numTeeth; i++) {
gear.appendAll(rotate(points, -i * 2 * pi / numTeeth));
}
mesh.log(`gear pitch radius: ${p.round(3)}`);
}
return gear;

View file

@ -410,7 +410,7 @@ let model = {
poly.addInner(
newPolygon().centerCircle({
x:0, y:0, z:0
}, shaft, Math.min(20+shaft,100))
}, shaft / 2, Math.min(20 + shaft,100))
);
}
let verts = poly.extrude(z || 15);