Skip to content

nesnes/VectorialLaserEngraver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

85026bd · Apr 9, 2018

History

5 Commits
Mar 4, 2018
Mar 4, 2018
Mar 4, 2018
Apr 9, 2018
Mar 4, 2018
Mar 4, 2018

Repository files navigation

Vectorial Driver for Mini Laser Engraver

This printer model comes with a program (scrave) that only print black and white images with slow scanning moves.

This program is the result of a retro enginering work to print SVG vector paths on this machine.

How to use

Create an SVG file

  1. Open your favorite SVG editor. (Like Inkscape)
  2. Create a 50mm x 50mm document and draw path on it.
    • Path stroke color should be in grayscale and will be interpreted as engraving depth.
    • If you want to print a text, select it and use the convert to path function.
  3. Save the SVG file.

Compatibility

  • Windows: Tested
  • Linux/Mac: Need serial port implementation in SerialPort.hpp. (and chase the last Sleep() calls)

Functionalities

  • Auto printer discovery and connection hover serial port
  • Preview the print area
  • Set the laser power and engraving depth
  • Print images. (uint8 buffers)
  • Print shapes.
  • Print SVG files
  • Simulate the printer by printing in an OpenCV windows. (No printer required)

Sample Code

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "LaserPrinter.hpp"
#include "SVGParser.hpp"

int main(int argc, char **argv) {
  bool simulate = false;
  LaserPrinter printer("auto", simulate);
  if(!printer.isConnected()) {
      std::cout << "Laser printer not found" << std::endl;
      exit(1);
  }

  int width, height;
  std::vector<LaserPrinterSegment> svgSegments = SVGParser::getSegments("github.svg", width, height);
  if(svgSegments.size() == 0) {
      std::cout << "Invalid file" << std::endl;
      exit(1);
  }
  printer.setPrintOrigin(0, 0);
  printer.startAreaPreview(width, height);
  Sleep(5000);
  printer.stopAreaPreview();
  printer.setLaserPower(1.f); // 100%
  printer.setEngravingDepth(0.6f); // 60%
  printer.printShape(svgSegments, width, height, true);

  std::cout << "Type a character to close: " << std::endl;
  char wait;
  std::cin >> wait;
  return 0;
}

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published