I need a plugin that adds spaces
-
When I get a g-code files from a fanuc machine. The machine deleted all the space. It is not easily readable anymore. So I need a plugin that ads the spaces again. (sending the files with spaces to the machine is no problem the machine removes them to conserve memory).
a file from the machine would look like this:
@018%
O1000
( COMMENTS )
M165
M62T12M6( CENTERBOOR SECO )
T37
M98P1001( NULPUNT VOORKANT RND 13 )
G00X0.Y0.S1800F300M3
G00G43H12Z60.M8
G82Z-3.R4.P400K0
M98P1013
M98P1002( NULPUNT VOORKANT M8 )
G00X0.Y0.S1800F300M3
G00G43H12Z60.M8
G82Z-2.R4.P400K0
M98P1008
%The machine put everything together except the comments ( )
Plugin needs to accept “blocks” a block is something like this: M98 or X123.43 or R4.
Here the file but then how I need to to be converted to:
@018%
O1000
( COMMENTS )
M165
M62T12 M6 ( CENTERBOOR SECO )
T37
M98 P1001 ( NULPUNT VOORKANT RND 13 )
G00 X0. Y0. S1800 F300 M3
G00 G43 H12 Z60. M8
G82 Z-3. R4. P400 K0
M98 P1013
M98 P1002 ( NULPUNT VOORKANT M8 )
G00 X0. Y0. S1800 F300 M3
G00 G43 H12 Z60. M8
G82 Z-2. R4. P400 K0
M98 P1008So can anybody help me with this?
Thanks -
What about using find/replace dialog with a regular expression like
\w\d+and replace with$0(there is a space after zero digit) -
better use
\w\-*\d+\.*to have negative movement and coordinate dots glued to correct code. -
Hello, @fortuneskills, @eko-palypse, and All,
Presently, I’m not able to give you a full reply to your request but I should have more time on next Sunday ! I’ll also need some other samples of code, either before ( text you get ) and after ( Text you would like to ), to improve my regex S/R !
Assuming your single example, here is my temporary solution :
-
SEARCH
(?-si)(?:\(.+?\)|@\d+?%|^\w{3,5}|[PSFM]\d+|[\w-]{2,3}\.?)(?=\R)|(^\w{3}|[PSFM]\d+|[\w-]{2,3}\.?) -
REPLACE
$0(?1\x20) -
Option
Wrap aroundticked -
Option
Regular expressionselected -
Click on the
Replace Allbutton
See you later,
Best Regards
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login