Skip to content

Commit 22e0f7e

Browse files
committed
Xregexp install natives
1 parent 17e6f53 commit 22e0f7e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib/action2gcode/generators/abstract-generator.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import XRegExp from 'XRegExp'
2-
XRegExp.install('natives')
1+
import XRegExp from 'xregexp';
2+
33
// AbstractDriver class
44
class AbstractGenerator {
55
// Class constructor...
@@ -9,7 +9,10 @@ class AbstractGenerator {
99

1010
postProcessRaster(gcode){
1111
if (this.settings.gcodeToolOn && this.settings.gcodeToolOff){
12-
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')
12+
gcode = XRegExp.replace(gcode,new XRegExp("G0(.*?)G1","gis"),'G0$1\n'+this.settings.gcodeToolOn+'\nG1')
13+
gcode = XRegExp.replace(gcode,new XRegExp("G1(.*?)G0","gis"),'G1$1\n'+this.settings.gcodeToolOff+'\nG0')
14+
return gcode;
15+
//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')
1316
}
1417
return gcode;
1518
}

0 commit comments

Comments
 (0)