Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    I need a plugin that adds spaces

    Help wanted · · · – – – · · ·
    3
    4
    510
    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.
    • Fortuneskills
      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 palypse 1 Reply Last reply Reply Quote 0
      • Eko palypse
        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 palypse
          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
          • guy038
            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
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors