0.0.6 • Published 3 years ago
Share package EBBPlotter An easy way to plot SVGs processed with vpype for plotters using the EBB . This library only supports the <polygon> and <polyline> SVG elements (the output format of vpype).
Installation $ npm i ebbplotterUsage This library outputs in both the CommonJS and ES module syntax and includes its own types if using TypeScript.
// import
import Plotter from 'ebbplotter';
// require
const Plotter = require('ebbplotter').default;Basic usage to plot an SVG:
import * as fs from 'fs';
import * as path from 'path';
import Plotter from 'ebbplotter';
const svgPath = path.resolve(__dirname, './smiley.svg');
const svg = fs.readFileSync(svgPath, 'utf-8').toString();
const plotter = new Plotter({
machine: { limits: { x: 300, y: 300 } },
});
try {
await plotter.plot(svg);
} catch (e) {
console.error(`Plot failed; with error: ${e}`);
}Plotter Options Name Default Description Type isVirtual falseIndicates if the plotter should run in virtual mode. In virtual mode, no serial connection is made and serial writes are simulated. booleanisDebug falseIndicates if debug logging should be enabled. booleanmachine See machine options Options related to the plotter.
Machine Options Name Default Description Type path (empty string) The serial path to use when conncting to the ebb device. If blank, the program will attempt to find the device automatically. booleaninitDuration 1000How long to wait in ms between performing setup and actually plotting. numberdisableMotorsOnFinish trueIndicates if the plotter should disable the motors after completing a plot. booleanstepper See stepper options Options related to the stepper motor. servo See servo options Options related to the servo motor. limits.x 300The X travel limit in mm. numberlimits.y 218The Y travel limit in mm. number
Stepper Options Name Default Description Type stepMode 2The micro-stepping mode to use in the range of 1-5. See the SM command reference for more info. numberstepAngle 1.8The step angle used by the stepper motors in degrees. numberbeltPitch 2The pitch of the timing belts on the machine in millimeters. The common GT2 belts use a 2mm pitch. numbertoothCount 20The number of teeth on the stepper motor timing pulleys. numberswapAxes falseIndicates if the X and Y axes should be swapped. booleanspeed See stepper speed options Options related to the stepper motor speed.
Stepper Speed Options Name Default Description Type min 200The lower range in steps per second the motors are allowed to move at. numbermax 5000The upper range in steps per second the motors are allowed to move at. Note that the EBB can drive at a maximum of 25,000 steps per second. numberdown 80The plot speed while the pen is down as a percentage between the stepper's min and max speed. numberup 60The plot speed while the pen is up as a percentage between the stepper's min and max speed. number
Servo Options Name Default Description Type duration 1000The amount of time it takes for the pen to reach either the up or down state. numberrate 0The servo rate in pulses per channel, 0 for full speed. See the SC,10 command reference for more info. numbermin 9855The minimum value for the servo's position in units of 83.3 ns intervals. See the SC,4 command reference for more info. numbermax 27831The maximum value for the servo's position in units of 83.3 ns intervals. See the SC,5 command reference for more info. numberdown 30The position of the servo when the pen is down as a percentage of the servo's min and max. numberup 70The position of the servo when the pen is up as a percentage of the servo's min and max. number
License ISC