Skip to content

Commit

Permalink
Xregexp install natives
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgerobles committed Jun 29, 2018
1 parent 17e6f53 commit 22e0f7e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib/action2gcode/generators/abstract-generator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XRegExp from 'XRegExp'
XRegExp.install('natives')
import XRegExp from 'xregexp';

// AbstractDriver class
class AbstractGenerator {
// Class constructor...
Expand All @@ -9,7 +9,10 @@ class AbstractGenerator {

postProcessRaster(gcode){
if (this.settings.gcodeToolOn && this.settings.gcodeToolOff){
return gcode.replace(new XRegExp("G0(.*?)G1","gis"),'G0$1\n'+this.settings.gcodeToolOn+'\nG1').replace(new XRegExp("G1(.*?)G0","gis"),'G1$1\n'+this.settings.gcodeToolOff+'\nG0')
gcode = XRegExp.replace(gcode,new XRegExp("G0(.*?)G1","gis"),'G0$1\n'+this.settings.gcodeToolOn+'\nG1')
gcode = XRegExp.replace(gcode,new XRegExp("G1(.*?)G0","gis"),'G1$1\n'+this.settings.gcodeToolOff+'\nG0')
return gcode;
//return gcode.replace(new XRegExp("G0(.*?)G1","gis"),'G0$1\n'+this.settings.gcodeToolOn+'\nG1').replace(new XRegExp("G1(.*?)G0","gis"),'G1$1\n'+this.settings.gcodeToolOff+'\nG0')
}
return gcode;
}
Expand Down

0 comments on commit 22e0f7e

Please sign in to comment.