Search the Community
Showing results for tags 'serc'.
Found 1 result
Hi folks, Thank you so much in advance for your help! I've been using AUTOIT for manipulating gcode. So far I've just worked through the excellent help examples and although I'm sure the resulting code is clumsy it has functioned However now I'm trying to improve and advance things and I've stumbled across REGEX.. and I'm a bit stuck. What I would like to be able to do is to 'move'/'transform' the gcode in a file and re-write it to a new file. I only need to move it in one direction(X). At the heart of this I need a script to extract all the X values and then ADD or SUBTRACT an adjustment factor to transform and rewrite the code accordingly. So far using an example script and an example input - Func Test2() Local $iMove = -4 Local $sInput = '"G1 X45.036 Y6.934 F7800.000 G1 Z0.600 F7800.000 G1 F900 G1 X48.036 Y1.076 E0.58925"' Local $sOutput = StringRegExpReplace($sInput, '(?<=[X])\d+.\d+', '\0') Display($sInput, $sOutput) EndFunc ;==>Test2 This identifies the correct values i.e 45.036 and 48.036 but is there a way to dyamically adjust them before they are replaced, by for example a factor of -4 ($iMove above). So far I can't seem to do math on the '\0' value i.e '\0'+ -4 ? Many thanks for your time and expertise!