+, with its line-break chars \R ( = \r\n for Windows files, \n for Unix files, or \r for Mac files ) +\R catches all the characters of any non-null line. The part ^(?! LAYER:1) search all the lines which not begin with the string LAYER:1Īnd the part. * represents any range of standard characters, possibly null As all the part is surrounded by parentheses, its contents are stored as group 1įinally, the part. followed by decimal digits \d+ and a space char \x20 then the exact letter Y and … ( same process than for X ). The part (X\d+\.\d+\x20Y\d+\.\d+) search for the exact letter X, followed with some digits \d+, followed with a literal dot \. + represents any non-null range of standard characters The part ^G looks for strings G0 or G1, beginning current line Then the search regex contains two alternatives, separated with the | symbol : The search is run in a non-insensitive way (?-i) Would output this text : X184.218 Y123.524Īny dot regex symbol represents a single standard character and not EOL chars, as \r or \n (?-s) We don’t know if you speak of lines which begin, contain or end with LAYER:1 ! I suppose that it is which begin… So what, exactly, defines ‘this section’?Īh, OK ! With your new specifications, it’s easier to get the right regex, at once -))įor the other lines I want to delete everything else except lines that looks like this You appear to indicate that the ‘last line’ of ‘this section’ is M204 S500, since that’s the line you show as being retained in your second post, but in your gcode file, I see lots instances of lines with M205 X5 Y5 - not shown in any of your posted examples - immediately following those with M204 S500, as in the following data extracted from your gcode: M204 S625 M204 S625 - I want to delete everything in this section except the the last line Are those to be ignored in whatever operation we come up with? There are also many other lines in your gcode that don’t resemble any of those in your posted examples, especially at the beginning and end of the file. Does every line that contains the X and Y values you want to keep begin with G1? Not sure if already got this worked out the way you wanted, but I was going to take a gander at this, and have downloaded a copy of your gcode for further inspection, though I have to admit that it’s far from clear to me what to keep and what to discard.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |