G code highlighting

Syntax highlighting, code folding, brace matching, code indenting, and function list

G code highlighting

Postby mace » Mon Jul 23, 2007 3:07 pm

Hello all
I have been using ultraedit for years to edit g code for manufacturing
How do I get this thing to highlight G0 in Green and Z-.75 in red etc.. etc..

here is example of my code !

% 2VSH32160_MACHINE ,MX--,
;POSTED :07/06/07 16:55:49, BY: BRENT
;CUSTOMER :
;EP :
;PROGRAM # :
;PROGRAMMER: BRENT
;(OPERATOR MESSAGES HERE)
G53
G48 S0
G90
;G29Y; Y TABLE INDEPENDANT
;G28YV; V TABLE INDEPENDANT
G51 E.003
N1 T8
N2 M6
N3 D8
G48S1
N4 S15000 M3
N5 G0 X59.418 Y-23.375 Z7.5072 A90.0 C0.0
N6 Y-20.85 Z7.5072
N7 G1 Y-20.75 F50.0
N8 X61.6868 Z5.1009
N9 X63.4441 Z5.0962
N10 X65.2158 Y-20.75 Z5.0994
N11 X67.0238 Z5.1105
N12 X68.8744 Z5.1299
N13 X70.7844 Y-20.75 Z5.1579
N14 X72.7887 Z5.1953
N15 X74.9415 Z5.2432
N16 X76.3234 Z5.2776
N17 X78.8413 Z5.3524
N18 X81.2952 Z5.4331
N19 X83.6686 Y-20.75 Z5.519
N20 X85.4493 Z5.5887
N21 X85.4727 Z5.5897
N22 Z5.5897
N23 X86.2958 Z5.6235
N24 X87.1554 Z5.7088
N25 X89.4892 Z5.8065
N26 Z5.8065
N27 X93.6409 Z5.9775
N28 X97.7581 Y-20.75 Z6.1549
N29 X97.7848 Z6.1559
N30 X99.4257 Z6.2107
N31 X99.6104 Z6.2181
N32 X99.752 Z6.2246
N33 X100.2391 Z6.1983
N34 X100.2992 Z6.1995
N35 X100.3384 Z6.2016
N36 X103.7716 Y-20.75 Z6.3633
N37 X106.9396 Z6.5197
N38 X109.8978 Z6.6731
N39 X112.6328 Z6.822
N40 X113.3357 Z6.8653
N41 X114.0594 Z6.9179
N42 X114.8108 Z6.9807
N43 X115.5915 Y-20.75 Z7.0541
N44 X116.1138 Z7.1075
N45 G0 Y-23.375 Z7.1075
N46 X58.5085 Y-23.375 Z6.6497
N47 Y-20.85 Z6.6497
N48 G1 Y-20.75
N49 X61.1445 Z3.8539
N50 X62.9208 Z3.8468
N51 X64.6908 Y-20.75 Z3.8476
N52 X66.4889 Z3.8564
N53 X68.3267 Z3.8733
N54 X70.2215 Y-20.75 Z3.8987
N55 X72.19 Z3.9331
N56 X74.2934 Z3.9777
N57 X76.3572 Z4.0281
N58 X78.8769 Z4.1029
N59 X81.3328 Z4.1837
N60 X83.7084 Y-20.75 Z4.2696
N61 X85.5008 Z4.3398
N62 X85.5251 Z4.3408
N63 Z4.3408
N64 X86.3836 Z4.3761
N65 X87.2431 Z4.4614
N66 X89.542 Z4.5576
N67 Z4.5576
N68 X93.6977 Z4.7288
N69 X97.8132 Y-20.75 Z4.9061
N70 X97.8132 Z4.9062
N71 X99.469 Z4.9614
N72 X99.6674 Z4.9694
N73 X99.7469 Z4.973
N74 X100.2335 Z4.9468
N75 X100.3238 Z4.9496
N76 X100.344 Z4.9495
N77 X100.365 Z4.9502
N78 X100.3425 Z4.9495
N79 X100.3959 Z4.9529
N80 X103.8302 Y-20.75 Z5.1147
N81 X106.9996 Z5.2712
N82 X109.9594 Z5.4246
N83 X112.7025 Z5.574
N84 X113.4132 Z5.6177
N85 X114.1442 Z5.6707
N86 X114.901 Z5.7338
N87 X115.6863 Y-20.75 Z5.8074
N88 X116.2449 Z5.8644
N89 G0 Y-23.375 Z5.8644
Z20.0
M5
G0 X0 Y0 A0 C0 F1200
G48S0
M0
G53
G0Z0.
G0X0.Y0.A0.C0
M30


Thanks in advance
Mace
User avatar
mace
Newbie
 
Posts: 1
Joined: Sun Jul 22, 2007 11:00 pm

Re: G code highlighting

Postby Mofi » Tue Jul 24, 2007 10:38 am

You can start with the Mill G Code - 04/14/99 syntax highlighting wordfile.

Move your mouse over the menu Downloads of the JavaScript menu at top of the page, move your mouse down to Additional Downloads, move your mouse right over Wordfiles and click on it with primary (left) mouse button.

If you have not enabled JavaScript, you can also click on the Downloads item in the Main Menu on left side. Next click on Wordfiles & More. Then click on Syntax Highlighting Wordfiles.

At top of this page you will find some instructions how to add the content of a wordfile you can download on this page to the wordfile you currently use.

The date of the wordfile for "G code" makes clear that this wordfile is old and surely does not enable all the enhanced syntax highlighting feature of the latest versions of UltraEdit.

The wordfiles are written by users like you and are sent to IDM which host it without really testing it. Why? Because for testing/updating a wordfile big knowledge about the syntax of the highlighted language and good example files are necessary. You can't suppose that IDM really has the knowledge and example files for all the languages for which wordfiles exist.

IDM highly welcomes contributions from users. So if you have high knowledge about "G code" and lots of example files, please improve the really old wordfile for "G code" and when finished send it to IDM. My macro set to sort the keywords of a syntax highlighting definition, find duplicate words and find invalid words will be maybe a help for you - see the ultimate syntax highlighting tools.

If you need further help to create the improved syntax highlighting wordfile for "G code", post here your questions and I will try my best to answer it and help you.

There is a big help page titled Syntax Highlighting in help of UltraEdit which explains what you can use for syntax highlighting and how to create your own language definition.

A user has written also a Template for syntax highlighting language wordfile which you can also use.

There are also some Power Tips about syntax highlighting wordfiles.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4069
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: G code highlighting

Postby Robertino » Wed Aug 08, 2007 11:59 am

Hi,

Try the following which works pretty well for me:

/L13"NC Files" Nocase Line Comment = $ Block Comment On = ( Block Comment Off = ) File Extensions = ISO NC CNC
/Delimiters = Q( )=+*
/Function String = "%[%+O+:]*"
/C1"G-Codes"
** G
/C2"M-Codes"
** M
/C3"Rotary and Linear Positioning"
** A B C U V W X Y Z
/C4"Angle, Radius"
** I J K R
/C5"Speeds and Feeds"
** F S
/C6"Line-Numbers, Tools"
** N T
/C7"Radius-, Length-Offsets"
** D H
/C8"Other stuff"
** % : E L O

Just go to Advanced->Configuration->Editor display->Syntax highlighting, open the wordfile and paste the above code at the end of the file. Make sure that no other language in the file uses the /L13 number, or alter the /L number for NC Files to the next free number.

Save the wordfile: then, while still in the Syntax highlighting window, choose "NC files" from the Language dropdown, and go through the Color Groups for the NC language, altering colors to taste.

Have fun!

Rob
User avatar
Robertino
Newbie
 
Posts: 1
Joined: Tue Jun 13, 2006 11:00 pm


Return to Syntax Highlighting