@jwc/jscad-gears
v2.0.0
Published
jscad parts library to create gears
Downloads
7
Readme
jscad-gears
This library creates JsCad gears, it is based on the Involute Spur Gear Builder . This library uses the
jscad-utils library and return jscad-utils group
objects.
Installation
Install jscad-gears
using NPM:
npm install --save jscad-gears jscad-utils
Basic usage
To use the gears package, you need to include the jscad-gears.jscad
file and jscad-utils.jscad
.
main() {
util.init(CSG);
var qualitySettings = {
resolution: CSG.defaultResolution2D,
stepsPerToothAngle: 3
};
var wheel = { id: 78.5, od: 104.1, h: 22 };
var toothCount = 64;
var g = new Gear({
toothCount,
circularPitch: (Math.PI * (wheel.id + 4)) / toothCount,
toothCount: toothCount,
qualitySettings: qualitySettings
});
var shape = g.getZeroedShape();
return util.poly2solid(shape, shape, 15);
}
Yeoman Generator
You can use the yeoman jscad generator which will create a project that uses this library.
Once you create your project, install jscad-gears
, and run gulp
. Dragging the dist
directory into
http://openjscad.org/ will include this library.
Modify your main.jscad
file to return a RaspberryPi object.
// include:js
// endinject
/* exported main, getParameterDefinitions */
/* globals piexample */
function main(params) {
util.init(CSG);
var qualitySettings = {
resolution: CSG.defaultResolution2D,
stepsPerToothAngle: 3
};
var wheel = { id: 78.5, od: 104.1, h: 22 };
var toothCount = 64;
var g = new Gear({
toothCount,
circularPitch: (Math.PI * (wheel.id + 4)) / toothCount,
toothCount: toothCount,
qualitySettings: qualitySettings
});
var shape = g.getZeroedShape();
return util.poly2solid(shape, shape, 15);
}
© 2016 John Cole [email protected].