• Login
Community
  • Login

I need a plugin that adds spaces

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 849 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F
    Fortuneskills
    last edited by Jan 25, 2019, 11:03 AM

    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
    M62

    T12M6( 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
    M62

    T12 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 P1008

    So can anybody help me with this?
    Thanks

    E 1 Reply Last reply Jan 25, 2019, 11:54 AM Reply Quote 0
    • E
      Eko palypse
      last edited by Jan 25, 2019, 11:49 AM

      What about using find/replace dialog with a regular expression like \w\d+ and replace with $0 (there is a space after zero digit)

      1 Reply Last reply Reply Quote 2
      • E
        Eko palypse @Fortuneskills
        last edited by Jan 25, 2019, 11:54 AM

        @Fortuneskills

        better use \w\-*\d+\.* to have negative movement and coordinate dots glued to correct code.

        1 Reply Last reply Reply Quote 2
        • G
          guy038
          last edited by Jan 25, 2019, 11:21 PM

          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 around ticked

          • Option Regular expression selected

          • Click on the Replace All button

          See you later,

          Best Regards

          guy038

          1 Reply Last reply Reply Quote 2
          2 out of 4
          • First post
            2/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors