diff --git a/src/lib/action2gcode/generators/abstract-generator.js b/src/lib/action2gcode/generators/abstract-generator.js index a61c1100..9e58f70b 100644 --- a/src/lib/action2gcode/generators/abstract-generator.js +++ b/src/lib/action2gcode/generators/abstract-generator.js @@ -1,5 +1,5 @@ -import XRegExp from 'XRegExp' -XRegExp.install('natives') +import XRegExp from 'xregexp'; + // AbstractDriver class class AbstractGenerator { // Class constructor... @@ -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; }