You are here: PSPad forum > English discussion forum > Working with G-Code
Posted by: ArmanHayots | Date: 2022-12-02 04:09 | IP: IP Logged
Tried to make color scheme for G-code language, but failed because it primarily uses letters, not words. Check the example:
M01
G21 G17 G40 G90 G54
T1 M06 G43 H1
M03 S1000
G00 X59. Y-90.
Z20. M08
G82 X-59. Y-90. Z-2. R5. P1. F60. L0
G70 I65. J45. L4 (4 M8)
G82 X-59. Y-47.5 (1 D3 OIL CHANNEL)
G82 X-144. Y-56. (1 D3 OIL CHANNEL)
G80 M09
G53 G00 Z0
M05
DPRNT[***CENTERING*ENDED***]
As you can see, typical command look like A20, G54, F120., X-10. etc., while pspad unable (or not?) to handle k̶e̶y̶w̶o̶r̶d̶, excuse me, keyletter without space symbol on the end.
What we can do with that?
Another proposal is an ability to automatically turn all lowercase letters to uppercase just on typing without any manual conversion.
Posted by: pspad | Date: 2022-12-02 05:11 | IP: IP Logged
Can you post any picture or something how do you imagine highlighting?
When I want to write all letter as uppercase, I switch on CapsLock
Posted by: pspad | Date: 2022-12-02 06:16 | IP: IP Logged
Just now without any program modification I am able to do this:
I can modify user highlighter engine to support keyword delimiters - there should be numbers, ".", "-". This will allow you to highlight commands Z, X, Y e.t.c.
Here is the current definition
pastebin.com
Edited 1 time(s). Last edit at 2022-12-02 06:16 by pspad.
Posted by: pspad | Date: 2022-12-02 12:03 | IP: IP Logged
This one is with modified HL
Is't ideal but I think it can fullfill purpose.
Modified highlighter include G-CODE definition will be available in the next build
Posted by: ArmanHayots | Date: 2022-12-12 11:16 | IP: IP Logged
Looks good, but DPRNT content colored strange.
Dont think that all G and M-commands must be in rules so just letters enough; therefore also a custom G-codes can be created and putting all of them in rules makes a mess.
May be way to use regular expressions?
Posted by: ArmanHayots | Date: 2022-12-12 11:19 | IP: IP Logged
pspad:When I want to write all letter as uppercase, I switch on CapsLock
Ohh, I see. Im using typewriter keyboard layout with CapsLock as language switcher, so thats not my way. Anyway, nevermind. Proper highlighting is a much more important.
How I can help?
Posted by: pspad | Date: 2022-12-12 12:52 | IP: IP Logged
ArmanHayots:Looks good, but DPRNT content colored strange.
Dont think that all G and M-commands must be in rules so just letters enough; therefore also a custom G-codes can be created and putting all of them in rules makes a mess.
May be way to use regular expressions?
Try current developer build. It handles DPRNT as well.
It contains D-CODE definition too, so if you will modify it, send me your modification please
Posted by: ArmanHayots | Date: 2022-12-22 08:45 | IP: IP Logged
Thank you, downloaded 747.
Modified color scheme for a bit.
Found bugs:
- Wrong work with minus sign. X20. works while X-20. dont
- As you can see, I put DPRNT in same group with IF, WHILE etc. and on when magic checkbox enabled, things like DO1 or END1 works but DPRNT dont't
- Sometimes there's a bug with duplicating symbols — on word wrap or selection I can see one symbol two times.
;PSPad user HighLighter definition file
[Settings]
Name=G-CODE
HTMLGroup=0
Vectors=0
Label=0
PHPVariable=0
RubySymbols=0
FileType=*.gcode,*.nc
CommentString=
OkumaComment=1
IndentChar=
UnIndentChar=
TabWidth=0
CaseSensitive=1
SingleQuote=0
DoubleQuote=1
ApostropheQuote=0
KW1StartWith=0
KW2StartWith=1
KW3StartWith=1
KW4StartWith=1
EscString=0
EscChar=\
KeyWordChars=_.
CodeExplorer=ftUnknown
CodeFolding=ftNone
DocComment=
[KeyWords]
DO=
DPRNT=
END=
EQ=
GE=
GOTO=
GT=
IF=
LE=
LT=
NE=
THEN=
WH=
WHILE=
[ReservedWords]
G=
M=
[KeyWords2]
D=
E=
F=
H=
L=
N=
O=
P=
Q=
R=
S=
T=
[KeyWords3]
A=
B=
C=
I=
J=
K=
U=
V=
W=
X=
Y=
Z=
Posted by: pspad | Date: 2022-12-28 12:26 | IP: IP Logged
Hello
Both cases - negative numbers and keywords like DPRNT[...] are fixed. It will be part of next developer build
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR