I’m working on a post processor for my controller and trying to put some operator notes on the consumable in the form of comments. I’m able to use the breakpoints to identify variables in the stack, but some variables only occasionally show up. Specifically, I’m trying to access the “operationName” variable so that I can pull my tool name from it (as it defines the amperage and thickness of the material).
Any ideas as to why the variable is there sometimes and not others?
welcome to the forum.
The variable ‘visibility’ (not necessarily scope) in the pp that you observe is correct in that some vars don’t get instantiated until related toolpath events. In the case of operationName, the event is OnNewOperation(). In the case of toolName, OnToolChange(). And you are correct in that often times you must simply debug the pp with breakpoints to observe the stack in order to know when certain variable are available or refreshed. var leadinType is an interesting example, it gets updated depending on the point read along the toolpath; OnPenDown() vs. OnPenUp() will likely have different values for it.
If you are in the debugger, then I suspect you’ve seen the pp doc. btw- the doc is also available direct from your browser since its .html format, see- file:///C:/Program%20Files%20(x86)/SheetCam%20TNG/Languages/en/HTML/Post%20Processor.htm
re. comments and notations- if OnComment() is defined, I believe all the text in the Tool and Operation ‘Notes’ tab is output as comments in the gcode file automatically.
for use of these functions and comments such as you are intending, see this exemplar pp - Post Processor Example w Custom Options popup window