Insert new lines
-
Hello.
I m looking for a solution to insert new line before (=M16) and after (=M15) a line who begin with “G00”. triyng with find and replace tool and no succes for now. it’s a cnc file, .txt work well. (a large amount of coodinates for laser metal cuting)
I hope someone can help. Thanks a lot
-
I found the multiReplace plugin, but I don’t know how to code. Data: identify the line (x) with the character sequence “G00” /
Add a line before with “M16” / add a line after with “M15”exple:
G01 X121.191 Y160.1338
G01 X121.128 Y160.1298
G01 X119.065 Y160.0648
G00 X166.159 Y331.3997
G01 X164.095 Y331.3997
G01 X164.032 Y331.4027
G01 X163.969 Y331.4067to
G01 X121.191 Y160.1338
G01 X121.128 Y160.1298
G01 X119.065 Y160.0648
M16
G00 X166.159 Y331.3997
M15
G01 X164.095 Y331.3997
G01 X164.032 Y331.4027
G01 X163.969 Y331.4067 -
I realize that this is a lot to ask, a piece of code, you probably have other things to do. I am a self-employed blacksmith and I am grateful to have a lot of work. but it is exhausting. so if I can find some help for this project I would be very grateful. thank you
-
you may try the following:
- Make sure that under Search Mode “Regular Expression” is selected
- In the “Find what” Field enter
^(G00 X[0-9\.]+ Y[0-9\.]+)
- In “Replace with” enter
=MIN16\r\n$1\r\n=MIN15
- Hit “Find next” followed by “Replace” or use “Replace all”
To learn more about Regular Expressions you may want to have a look at https://community.notepad-plus-plus.org/topic/15765/faq-where-to-find-regular-expressions-regex-documentation
-
hello @gerdb42
It works very well. your kungfu is powerful. thank you very much for the help. and thank you for the link, I will look into it.