Author Topic: A simple change???  (Read 21335 times)

Offline Triode

  • Ewok
  • *
  • Posts: 8
    • View Profile
A simple change???
« on: November 06, 2008, 15:45:40 pm »
Hi, I am looking for a simple way to change G-code so that on every instance of a rapid (G0) there is an M31 before, and an M32 aft.
For Example

This:-
G1 X290.0702 Y301.1827
G0 X282.9471 Y302.4629
G1 X283.0283 Y302.9148

Ends up as this:-
G1 X290.0702 Y301.1827
M31
G0 X282.9471 Y302.4629
M32
G1 X283.0283 Y302.9148

I hope I haven’t overlooked the obvious. Any ideas much appreciated as hand editing is a long process on 50,000 lines. I am not sure how to modify the post processor as I have not got to grips with the language style.

Thanks,
Dwight

Offline Hans_G

  • Storm Trooper
  • ***
  • Posts: 109
    • View Profile
Re: A simple change???
« Reply #1 on: November 06, 2008, 19:07:01 pm »
Here's a quick and dirty solution til Andy sets you up right...

if you have a text editor that with a Find/Replace feature that supports regular expressions (like Visual Studio Express), you can search for "^G0 X.:d*.:d* Y.:d*.:d*" and replace with "M31\n\0\nM32".  You may need to turn on regular expression usage in the options if using Visual Studio.

Offline blowlamp

  • CNC Jedi
  • *****
  • Posts: 1192
    • View Profile
Re: A simple change???
« Reply #2 on: November 06, 2008, 19:17:59 pm »
I know nothing about post processors, but it didn't stop me having a fiddle :). I changed the Fanuc post in the way shown (highlighted) in the attached picture. The line is split into 3 because I pressed the Enter key after each command to ensure the G/M Codes had their own lines, rather than being bunched up on the 1 line. You could change your post in a similar way. Picture 2 shows the Gcode file produced with the modification ;D. I'm sure someone will pipe up if this isn't the right way to do it, but it might do you for now.

All the best, Martin.

Offline Triode

  • Ewok
  • *
  • Posts: 8
    • View Profile
Re: A simple change???
« Reply #3 on: November 06, 2008, 20:37:50 pm »
Thanks chaps, works well, this will do just fine & save much time. If all goes well I will post the new Mortar Plotter here soon for all your amusement.

Dwight