示例#1
0
void DXFLibrary::add(js::ObjectTemplate &tmpl) {
  tmpl.set("open(path)", this, &DXFLibrary::openCB);

  tmpl.set("POINT",    DXFEntity::DXF_POINT);
  tmpl.set("LINE",     DXFEntity::DXF_LINE);
  tmpl.set("ARC",      DXFEntity::DXF_ARC);
  tmpl.set("POLYLINE", DXFEntity::DXF_POLYLINE);
  tmpl.set("SPLINE",   DXFEntity::DXF_SPLINE);
}
示例#2
0
void MatrixModule::define(js::ObjectTemplate &exports) {
  exports.set("pushMatrix(matrix)", this, &MatrixModule::pushMatrixCB);
  exports.set("popMatrix(matrix)", this, &MatrixModule::popMatrixCB);
  exports.set("loadIdentity(matrix)", this, &MatrixModule::loadIdentityCB);
  exports.set("scale(x=1, y=1, z=1, matrix)", this, &MatrixModule::scaleCB);
  exports.set("translate(x=0, y=0, z=0, matrix)", this,
           &MatrixModule::translateCB);
  exports.set("rotate(angle, x=0, y=0, z=1, matrix)", this,
           &MatrixModule::rotateCB);
  exports.set("setMatrix(m, matrix)", this, &MatrixModule::setMatrixCB);
  exports.set("getMatrix(m)", this, &MatrixModule::getMatrixCB);

  // TODO Consider replacing these with get(X), get(Y), etc.
  exports.set("getXYZ()", this, &MatrixModule::getXYZ);
  exports.set("getX()", this, &MatrixModule::getX);
  exports.set("getY()", this, &MatrixModule::getY);
  exports.set("getZ()", this, &MatrixModule::getZ);
}
示例#3
0
void GCodeLibrary::add(js::ObjectTemplate &tmpl) {
#define XYZ "x, y, z"
#define ABC "a, b, c"
#define UVW "u, v, w"
#define IJK "i, j, k"
#define AXES XYZ ", " ABC ", " UVW

  tmpl.set("gcode(path)", this, &GCodeLibrary::gcodeCB);
  tmpl.set("rapid(" AXES ", incremental=false)", this, &GCodeLibrary::rapidCB);
  tmpl.set("irapid(" AXES ", incremental=true)", this, &GCodeLibrary::rapidCB);
  tmpl.set("cut(" AXES ", incremental=false)", this, &GCodeLibrary::cutCB);
  tmpl.set("icut(" AXES ", incremental=true)", this, &GCodeLibrary::cutCB);
  tmpl.set("arc(x=0, y=0, z=0, angle, plane, incremental=true)", this,
          &GCodeLibrary::arcCB);
  tmpl.set("probe(" AXES ", toward=true, error=true, index=0, port=-1, "
          "invert=false)", this, &GCodeLibrary::probeCB);
  tmpl.set("dwell(seconds)", this, &GCodeLibrary::dwellCB);
  tmpl.set("feed(rate, mode)", this, &GCodeLibrary::feedCB);
  tmpl.set("speed(rate, surface, max)", this, &GCodeLibrary::speedCB);
  tmpl.set("tool(number)", this, &GCodeLibrary::toolCB);
  tmpl.set("units(type)", this, &GCodeLibrary::unitsCB);
  tmpl.set("pause(optional=false)", this, &GCodeLibrary::pauseCB);

  tmpl.set("tool_set(number, length, diameter, units, shape, snub=0, "
           "front_angle=0, back_angle=0, orientation=0)", this,
           &GCodeLibrary::toolSetCB);

  tmpl.set("FEED_INVERSE_TIME", INVERSE_TIME);
  tmpl.set("FEED_UNITS_PER_MIN", MM_PER_MINUTE);
  tmpl.set("FEED_UNITS_PER_REV", MM_PER_REVOLUTION);

  tmpl.set("IMPERIAL", MachineUnitAdapter::IMPERIAL);
  tmpl.set("METRIC", MachineUnitAdapter::METRIC);

  tmpl.set("XY", XY);
  tmpl.set("XZ", XZ);
  tmpl.set("YZ", YZ);
  tmpl.set("YV", YV);
  tmpl.set("UV", UV);
  tmpl.set("VW", VW);

  tmpl.set("CYLINDRICAL", OpenSCAM::ToolShape::TS_CYLINDRICAL);
  tmpl.set("CONICAL", OpenSCAM::ToolShape::TS_CONICAL);
  tmpl.set("BALLNOSE", OpenSCAM::ToolShape::TS_BALLNOSE);
  tmpl.set("SPHEROID", OpenSCAM::ToolShape::TS_SPHEROID);
  tmpl.set("SNUBNOSE", OpenSCAM::ToolShape::TS_SNUBNOSE);

#undef XYZ
#undef ABC
#undef UVW
#undef IJK
#undef AXES
}