Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments can start with semicolons #4

Open
drewnoakes opened this issue Aug 28, 2019 · 6 comments
Open

Comments can start with semicolons #4

drewnoakes opened this issue Aug 28, 2019 · 6 comments

Comments

@drewnoakes
Copy link

.gcode files generated by Cura use ; to denote a comment. For example:

;FLAVOR:Marlin
;TIME:13408
;Filament used: 8.36149m
;Layer height: 0.2
;MINX:109.242
;MINY:104.34
;MINZ:0.2
;MAXX:194.408
;MAXY:195.66
;MAXZ:48.6
;Generated with Cura_SteamEngine 4.2.1
M140 S60
M105
M190 S60
M104 S200
M105
M109 S200
M82 ;absolute extrusion mode
M201 X500.00 Y500.00 Z100.00 E5000.00 ;Setup machine max acceleration
M203 X500.00 Y500.00 Z10.00 E50.00 ;Setup machine max feedrate
M204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration
M205 X8.00 Y8.00 Z0.40 E5.00 ;Setup Jerk
M220 S100 ;Reset Feedrate
M221 S100 ;Reset Flowrate

Because these comments are not recognised, the output renders as:

image

Not only are they harder to differentiate by colour, but the content within the comments is subject to highlighting.

@sketch4x4
Copy link

ok, so i came here about to ask the same question and after a few hours of research about xml short hand character classes.

I've figured it out by changing the string values in both tmLanguage files.

open up both files and edit between and with [;\w\s\d(.*)]
Screenshot from 2020-11-12 23-17-42
Screenshot from 2020-11-12 23-17-45

and your gcode should now look like this
Screenshot from 2020-11-12 23-17-39

There might be a better way of doing this but being 2 hours into learning xml code this is the best i could come up with.

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented Mar 19, 2022

+1 on this needing to be added to the syntax highlighter plugin

@ElectricRCAircraftGuy
Copy link

See this alternate version, and my installation instructions, here: #2 (comment)

@themachinist
Copy link
Owner

themachinist commented Mar 21, 2022

@sketch4x4 I'm thinking you could simply use the expression [;.*] which translates to a list expression matching a semi-colon followed by zero or more occurrences (*) of any character (.)

I've reinstalled git and all that mess today. I will look at merging this change into the main branch on monday.

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented Mar 21, 2022

Hi @themachinist , I've started a new stand-alone project here: https://github.com/ElectricRCAircraftGuy/sublime_gcode.

I plan on keeping it maintained. If it would help you so you don't have to maintain yours anymore, feel free to update your readme to redirect people to my repo. I'll see if I can get it into the Package Control system too.

My version isn't complete, but I have it handling comments and a lot of the syntax already.

@ElectricRCAircraftGuy
Copy link

Done! See: #2 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants