How to use OnComment() event in the post processor?

Having problems with or questions about SheetCam? Post them here.
Post Reply
Trakyan
Posts: 14
Joined: Tue Mar 23, 2021 7:28 am

How to use OnComment() event in the post processor?

Post by Trakyan »

I'm having a hard time triggering the OnComment() event in the post processor. I had a look at the documentation but it wasn't very detailed for this specific function. What exactly does it consider a comment? I sort of assumed it was the cutting rules, or the snippets that can be attached to them. Maybe if it finds something enclosed in brackets (a comment) in the gcode snippet of a cutting rule? Then I tried turning on the include rulenames in gcode, that didn't work either.

What am I missing? I'm also having a hard time figuring out how the commentText variable is used. OnComment() says see commentText, commentText says it is something to do with the Comment() event (not OnComment()) but neither really explains anything.

The reason I'm doing this is my "on all corners" rule is overriding the "on small shapes" rule when i use a perpendicular leadin. The Small Shapes rule only kicks in after the on all corners (which is set to end at 15mm past the corner) which messes with things in my post processor and means the first 15mm is cut at a faster speed and the height controller isnt switched off.

Any help would be appreciated.
User avatar
Les Newell
Site Admin
Posts: 3668
Joined: Thu May 11, 2006 8:12 pm

Re: How to use OnComment() event in the post processor?

Post by Les Newell »

OnComment is triggered whenever SheetCam wants to output a comment. This is most often triggered when the notes from a tool are operation are output. The idea is that you use it to add whatever comment characters your control expects. The variable 'commentText' holds the current comment that is to be output.

In the path rules editor, do you have 'Show rule names in g-code' enabled? This can help with debugging rules.
Trakyan
Posts: 14
Joined: Tue Mar 23, 2021 7:28 am

Re: How to use OnComment() event in the post processor?

Post by Trakyan »

I tried it both with and without "show rule names in g-code" enabled. Are the rule names supposed to trigger the OnComment? I can't seem to make this trigger the OnComment() function. I think I got it to trigger once, but I'd changed a couple of things when I triggered it, and in the process of narrowing down exactly what triggered it, it stopped working and i haven't been able to get it working again.
User avatar
Les Newell
Site Admin
Posts: 3668
Joined: Thu May 11, 2006 8:12 pm

Re: How to use OnComment() event in the post processor?

Post by Les Newell »

I don't think 'show rule names' triggers OnComment. It's meant purely a debugging tool.
Trakyan
Posts: 14
Joined: Tue Mar 23, 2021 7:28 am

Re: How to use OnComment() event in the post processor?

Post by Trakyan »

The comments posted by OnNewOperation() and OnNewPart() don't seem to trigger it. Here's the OnComment() function I'm trying to use to debug the issue, maybe I've done something stupid and just can't see it.

function OnComment()
post.Text("(",commentText,")\n")
post.Text("(HI THERE)\n")
end

I think I copy/pasted it from one of the other postprocessors (other than the post.Text("(HI THERE)\n") obviously).
Post Reply