1.3.2 • Published 9 months ago
svg-to-gcode v1.3.2
Svg-To-GCode Converter
svg-to-gcode
is an npm package that helps in SVG file inputs into G-Code text for a plotter. It's a friendly modification of the opensource respository "exportSVGtoGCODE" by o0morgan0o, originally a Node CLI tool. You can easily incorporate this package into your frontend application.
Installation
Install the package using npm:
npm install svg-to-gcode
Or, use a script tag :
<script src="https://unpkg.com/svg-to-gcode@^1.0.0/dist/svg-to-gcode.js"></script>
<script>
// Configuration for the plotter gcode ( the values are in mm)
const settings = {
zOffset : 3,
feedRate : 3000,
seekRate : 2000,
zValue: 15,
tolerance: 0.1,
minimumArea: 2.5,
ignoreNegative: true,
bedSize: {
width: 420,
height: 297
}
}
// For using the default configuration , skip the settings
const converter = SvgToGcode(settings)
converter.convert(svgString).then((gcode) => {
// Manipulate the recieved gcode
console.log(gcode)
})
</script>
Usage
import { Converter } from 'svg-to-gcode'
// Configuration for the plotter gcode ( the values are in mm)
const settings = {
zOffset : 3,
feedRate : 3000,
seekRate : 2000,
zValue: -15,
tolerance: 0.1,
minimumArea: 2.5,
ignoreNegative: true,
sortByArea: true,
bedSize: {
width: 420,
height: 297
}
}
// For using the default configuration , skip the settings
const converter = new Converter(settings)
// You can download the generated gCode using this code
converter.convert(data).then((gcode) => {
const file = new Blob([gcode], { type: 'text/plain' });
const link = document.createElement('a');
link.href = URL.createObjectURL(file);
link.download = 'out.gcode';
link.click();
URL.revokeObjectURL(link.href);
})
1.3.2
9 months ago
1.2.8
10 months ago
1.2.7
10 months ago
1.3.1
9 months ago
1.3.0
9 months ago
1.2.9
10 months ago
1.2.10
10 months ago
1.2.0
12 months ago
1.2.6
11 months ago
1.2.5
11 months ago
1.2.4
11 months ago
1.2.3
11 months ago
1.2.2
12 months ago
1.2.1
12 months ago
1.1.2
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.1.6
1 year ago
1.0.2
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.1
2 years ago
1.0.0
2 years ago