Page 1 of 2 12 LastLast
Results 1 to 12 of 13

Thread: Find and Replace

  1. #1
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0

    Find and Replace

    I'm hoping someone has a simple answer to this question: my Shadow controllers use a "/" to designate a rapid move. The / must appear before each axis in a move like this
    /X /Y /Z
    for a three axis move.

    So I have my XP post driver set up to do Rapid Line format like this:

    {G}{X} {G}{Y} {G}{Z}

    This works fine all the time if I uncheck "coordinates modal."

    However, I hate that method because of the clutter and would much prefer to run with "coordinates modal". The problem occurs that whenever a duplicate move would have been inserted, that the rapid axis movement is deleted but the "/" remains.

    I can easily use "find and replace" to get rid of most of these "/"'s by entering a "/+space" in the find box and leave the replacement box empty.

    However, there are some instances when the "/" is alone at the end of a line, preceded by an X and/or Y move. This means that a Z was deleted because of the coordinate modality.

    I cannot figure out a way to quickly delete all these "end of line" slashes without painstakingly going through all the code to check. If they are present they do cause the controller to hang.

    Any Ideas? Is there a secret way to search for a character at the end of a line, which I presume is followed by a return character?
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  2. #2
    wms
    wms is offline
    Moderator wms's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    940
    Downloads
    0
    Uploads
    0
    Hu,
    Have you tried a replace " / (carriage return)" with a "carriage return" ?
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  3. #3
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    There seems to be no way that I can insert an ASCII character 10 or an ASCII character 13 in the search field.

    Is there any special prefix character a person can use to fool the seach function?
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  4. #4
    wms
    wms is offline
    Moderator wms's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    940
    Downloads
    0
    Uploads
    0
    Hu,
    In the find and replace window type:

    Find what box) / then enter
    replace with box) just enter
    Then click on replace all.

    I just tried this and it worked for me.
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #5
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    Pressing enter causes me to leave the search dialogue immediately because enter is the hotkey that makes the dialogue's "find next" button run.

    Here is a sample for you to try. Get rid of only the slash at the end of the first line, without any search pauses at any other slash:

    /X1.2717 /Y-2.8443 /
    /Z0.13
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #6
    wms
    wms is offline
    Moderator wms's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    940
    Downloads
    0
    Uploads
    0
    Hear that Sound?
    That's the SOUND of me wiping the EGG off my face.
    Once again you are right.

    I knew that if I tried to help YOU with an scripting or ASCII problem I would end up eating a big bucket of CROW.
    I don't know what I was thinking.
    Bad WMS, bad WMS.
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #7
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    Heheh.

    I was really hoping that I was the dense one, that you had the solution. I'll just have to wait and see if the next patch addresses this tiny issue. I have alerted them about this problem some time ago.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #8
    wms
    wms is offline
    Moderator wms's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    940
    Downloads
    0
    Uploads
    0

    Brain Fart

    Hu,
    I woke up at 3.30 am this morning with this "brain fart". It took me until now to work it out . See what you think.

    In your modal setting for your post:

    Check the cords
    Uncheck the G code
    check the feed rate

    In your post format: ( note a (s) below is a space in your format)

    Rapid line format:

    {G}{X}(s){G}{Y}(s){G}(s){Z}(s)

    (so there is a space before the{Z} and a space after)

    Ok now don't give I'm going somewhere with this.
    Post your code and open up your program in the editor.

    Your first find and replace looks like this:

    Find=G00
    Replace=/

    Then:
    Find=/(s)Z
    Replace=/Z

    Then:
    Find=/(s)
    replace=(nothing)

    I know this is alot of "find and replace" but I think it beats going thru the code by hand IMO.
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #9
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    Your brain fart got me thinking, Ward. I neglected to tell you that the slash at the end of a line could be due to a deleted X, Y or Z, which would mean I would have to have a space after every slash, not just before the Z.

    But, good news, you set me on a slightly different track that seems workable.

    Here was my old RAPID LINE FORMAT G00:
    {G}{X} {G}{Y} {G}{Z}, where the code {G} was given a prefix of / instead of G

    Here is the new one:
    {{G}{X}} {{G}{Y}} {{G}{Z}}

    Now, with coordinates modal ON, every instance of a solitary / appears as:
    {/} {/} {/Z1.2345}
    or
    {/X1.2345} {/}

    no matter if it is at the end of a line or not. These are all quickly and easily deleted.

    However each rapid move is also enclosed in {}, so the code looks like this:
    {/X1.6717} {/Y-1.2318} {/Z0.2}
    Again, a double application of find and replace all removes first the "{" and then the "}".

    Thanks for the insight that got me on track
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #10
    wms
    wms is offline
    Moderator wms's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    940
    Downloads
    0
    Uploads
    0
    Hu,
    More that one way to skin a cat. Not that I would skin a cat.
    Glad It worked out.
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #11
    wms
    wms is offline
    Moderator wms's Avatar
    Join Date
    Mar 2003
    Location
    United States
    Posts
    940
    Downloads
    0
    Uploads
    0

    Faster less work

    Hu,
    Try this:

    {G}{X}(s){G}{Y}(s){G}{Z}(s)(cr)

    Don't forget the cairage return after the (space) after the {Z}. Or the program will strip the space out.

    This will put a (space) after any lone / even at the end of a line.
    This way you only have to find /(s) and replace with (nothing).
    Again the(s) is a keyboard space. And (cr) is a cairage return, that is (enter).
    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #12
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    That is a vailant attempt, WMS and I appreciate your time spent thinking about this problem.

    Unfortunately, it seems that the NC editor automatically deletes that space at the end of the line anyways, so we still lose out. I did insert the enter after the space, but I think that this gets deleted too, because otherwise, we would see the lines of gcode double spaced.

    I did manage to narrow the search and replace down to just two operations. I now use this as my Rapid line format:

    {G}{X}} {G}{Y}} {G}{Z}}

    This gives me this format:

    /X1.2345} /Y1.2345} /Z1.2345}

    or, if the Z was deleted

    /X1.2345} /Y1.2345} /}

    Thus, I can do a search and replace first for all instances of:
    /}

    and then for just the one brace
    }

    However, your idea has the best germ for a true fix, the developers would just need to allow one space to exist at the end of every line. Hopefully, they can get around my having to do this completely, though.
    Last edited by HuFlungDung; 05-12-2003 at 06:20 PM.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. How to mirror GCode file?
      By anoah in forum General CAM Discussion
      Replies: 6
      Last Post: 07-08-2003, 01:26 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.