Community
    • Login

    I need a plugin that adds spaces

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.2k Views 1 Watching
    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.
    • FortuneskillsF Offline
      Fortuneskills
      last edited by

      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

      Eko palypseE 1 Reply Last reply Reply Quote 0
      • Eko palypseE Offline
        Eko palypse
        last edited by

        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
        • Eko palypseE Offline
          Eko palypse @Fortuneskills
          last edited by

          @Fortuneskills

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

          1 Reply Last reply Reply Quote 2
          • guy038G Offline
            guy038
            last edited by

            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

            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors