0.0.6 • Published 1 year ago

ebbplotter v0.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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 ebbplotter

Usage

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

NameDefaultDescriptionType
isVirtualfalseIndicates if the plotter should run in virtual mode. In virtual mode, no serial connection is made and serial writes are simulated.boolean
isDebugfalseIndicates if debug logging should be enabled.boolean
machineSee machine optionsOptions related to the plotter.

Machine Options

NameDefaultDescriptionType
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.boolean
initDuration1000How long to wait in ms between performing setup and actually plotting.number
disableMotorsOnFinishtrueIndicates if the plotter should disable the motors after completing a plot.boolean
stepperSee stepper optionsOptions related to the stepper motor.
servoSee servo optionsOptions related to the servo motor.
limits.x300The X travel limit in mm.number
limits.y218The Y travel limit in mm.number

Stepper Options

NameDefaultDescriptionType
stepMode2The micro-stepping mode to use in the range of 1-5. See the SM command reference for more info.number
stepAngle1.8The step angle used by the stepper motors in degrees.number
beltPitch2The pitch of the timing belts on the machine in millimeters. The common GT2 belts use a 2mm pitch.number
toothCount20The number of teeth on the stepper motor timing pulleys.number
swapAxesfalseIndicates if the X and Y axes should be swapped.boolean
speedSee stepper speed optionsOptions related to the stepper motor speed.

Stepper Speed Options

NameDefaultDescriptionType
min200The lower range in steps per second the motors are allowed to move at.number
max5000The 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.number
down80The plot speed while the pen is down as a percentage between the stepper's min and max speed.number
up60The plot speed while the pen is up as a percentage between the stepper's min and max speed.number

Servo Options

NameDefaultDescriptionType
duration1000The amount of time it takes for the pen to reach either the up or down state.number
rate0The servo rate in pulses per channel, 0 for full speed. See the SC,10 command reference for more info.number
min9855The minimum value for the servo's position in units of 83.3 ns intervals. See the SC,4 command reference for more info.number
max27831The maximum value for the servo's position in units of 83.3 ns intervals. See the SC,5 command reference for more info.number
down30The position of the servo when the pen is down as a percentage of the servo's min and max.number
up70The position of the servo when the pen is up as a percentage of the servo's min and max.number

License

ISC

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago