@jwc/jscad-gears

2.0.0 • Public • Published

view on npm npm module downloads

jscad-gears

gear example

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 johnwebbcole@gmail.com.

Readme

Keywords

Package Sidebar

Install

npm i @jwc/jscad-gears

Weekly Downloads

0

Version

2.0.0

License

ISC

Unpacked Size

2.27 MB

Total Files

45

Last publish

Collaborators

  • johnwebbcole