Changeable standard sign for comments in GCode

Hi guys,

first of all thank you for your great work!

I work with a CNC-Milling machine with an attached laser, unfortunatly my controller only understands CCode comments in between brackets.
Is there any chance to change the comment syntax or a workaround?

Example

GCode from Laserweb:

; this is a comment
M3 S1000

GCode from my generic postprocessor e.g. fusion360:

(this is a comment)
M3 S1000

Wish yall a great week,
walbran

I would check with what’s available from Fusion360 since the GCode standard is decades old and changing a package which supports the standard because a new plugin does not is likely going to get turned down.

Kiri:Moto( http://grid.space ) supports the GCode standard and so does FreeCAD and its postprocessors.

1 Like

@dougl I think that’s missing the point. The question is whether LW can also support the different comment syntax, not whether fusion can. Fusion already has that post available; the question is what’s available to take the post role here.

I just learned something. This is a proper comment in GCode:
( this is a comment )
M3 S1000

And this is a proper inline comment in GCode:
M3 S1000 ; this is a comment

so it’s not odd of the Fusion360 postprocessor to use “( comment )” for newline comments.

I’d not run across those comments in any of the 3D printer, laser nor CNC GCode I’ve generated but according to Tormach it seems completely normal way of doing it. About G-Code Programming Language

Ya and I’m still confused as to what they are asking. It sounds like they are using Fusion360 to generate GCode, the controller on their machine only accepts GCode with comments wrapped in parentheses and they are doing design work in LaserWeb which puts comments after semicolons which their controller can’t recognize. If that’s the case and since both methods of comments are acceptable in the GCode standard it’s a reasonable request even though most controller firmware knows about semicolon delimited comments.

I didn’t think parenthesis based comments were legal and figured the Fusion360 post was an oddity and they should look for one not so odd. Maybe it’s their laser(or CNC) controller which is odd and only supports parenthesis based comments.

No doubt the LaserWeb dev has a complete understanding of this and will chime in. In the meantime, does laserweb support a post processor script which could change the comments on the way out to the controller?

2 Likes

In the meantime, if you got a text editor which supports regex search & replace, you could replace:

;\s*(.*)$

with:

($1)

That turns something like:

;this is a comment
M3 S1000
;  this is a comment
M3 S1000
;   this is a comment
M3 S1000;this is a comment
M3 S1000 ; this is a comment

into:

(this is a comment)
M3 S1000
(this is a comment)
M3 S1000
(this is a comment)
M3 S1000(this is a comment)
M3 S1000 (this is a comment)

This simple workaround doesn’t handle quoted strings (which may contain semicolons), but that likely won’t be an issue.

2 Likes

Thanks that works perfectly!

In case someone else needs it (I use notepad++) make sure to escape before the parentheses like this in the replace line:

/($1/)

otherwise the parentheses will missing.

@dougl Yes you unterstood me right. Normally I’m milling wood with my CNC and process my designs in Fusion360 where I can choose a postprocessor wich only puts comments inside parentheses. But for Lasercutting/engraving I’m using vector-design software wich can’t be easily CAM-processed in Fusion360 (stationary Z-axis, different comments/parameters for the on/off/pwm signals and so forth). Laserweb brings all the things that I was looking for except the comment function.
Unfortunately my controller software is not capable of recognizing “;” as comment assigned line.

Is there a way to edit the postprocessor script in LW by myself? And would it be easy to change the comment syntax?

It would be really nice if this option is implemented in further versions!

What CAM tool and post-processor are you using? Usually the post-processor is where this sort of thing is adjusted.

Folks, pay attention to the category this was posted in!

It’s LaserWeb/CNCWeb: Suggestions/Feedback

This is asking for LaserWeb support for standard parenthesis-bracketed full-line comments.

1 Like

I did put the backslashes there first, but VS Code outputted them as-is.

Anyhow, glad to hear you got that sorted out. :slight_smile: