Gcode preview and remap
Attachments:
Please Log in or Create an account to join the conversation.
if fn == None:
fn = self.ilename
if fn.split....
notice same indentation level, you have additional indentation on the line with "if fn.split...". rule of thumb, if the previous line is a complete statement (no open parenthesis, ...) and doesn't end with a colon (":") then next line must be on same level.
Please Log in or Create an account to join the conversation.
Try using the #<_task> parameter in your subroutine so it is only executed when you are actually running the gcode program.
#<_task> - 1.0 if the executing interpreter instance is part of milltask, 0.0 otherwise. Sometimes it is necessary to treat this case specially to retain proper preview, for instance when testing the success of a probe (G38.n) by inspecting #5070, which will always fail in the preview interpreter (e.g. Axis).
Please Log in or Create an account to join the conversation.
It no longer gives the error message, but it didn't solve the problem. Still showing path of ATC. Still, thanks for the help.it says right there at the end of the error message. In python, indentation is part of the syntax. It needs to say
if fn == None: fn = self.ilename if fn.split.... notice same indentation level, you have additional indentation on the line with "if fn.split...". rule of thumb, if the previous line is a complete statement (no open parenthesis, ...) and doesn't end with a colon (":") then next line must be on same level.
Please Log in or Create an account to join the conversation.
The same advice give me rene-dev.The preview interpreter doesn't know if you want a subroutine displayed or not.
Try using the #<_task> parameter in your subroutine so it is only executed when you are actually running the gcode program.#<_task> - 1.0 if the executing interpreter instance is part of milltask, 0.0 otherwise. Sometimes it is necessary to treat this case specially to retain proper preview, for instance when testing the success of a probe (G38.n) by inspecting #5070, which will always fail in the preview interpreter (e.g. Axis).
github.com/LinuxCNC/linuxcnc/issues/2651...uecomment-1729335327
But I dont know how use #<_task>.
Please Log in or Create an account to join the conversation.
Attachments:
Please Log in or Create an account to join the conversation.
o300 if [#<_task> eq 1]
g10l2p0x1
(debug, Next: run with g5x xoffset=#5221, s to continue)
m0
o100 call
g10l2p0x0y0z0c0
g92x2
(debug, Next: run with g92 xoffset=#5211, s to continue)
m0
o100 call
o300 endif
Please Log in or Create an account to join the conversation.
I tried this:
(PREVIEW,hide)
<G-code to be hidden>
(PREVIEW, show)
linuxcnc.org/docs/2.9/html/gui/gmoccapy.html#_preview_control
But it didn't help on physical machine.
I'm stupid today.
Please Log in or Create an account to join the conversation.
o<ATC> sub
o100 if [#<_task> eq 1]
G53 G1 Z-19.5 f20000
G53 G1 Z0 f20000
o100 endif
o<ATC> endsub [10]
Please Log in or Create an account to join the conversation.
need the ATC exchange to happen every time, not just depending on some parameter. I just need Preview to ignore it.
The point is this:
gcode is run in a separate interpreter for the preview and for this the parameter #<_task> is = 0.
If the code is executed 'on the hardware' (by clicking on the 'Run' button) then the parameter #<_task> = 1.
So you check that parameter #<_task> == 1 to make the code in the if-endif subroutine invisible for the preview but execute it when you actually click on the 'Run' button.
Please Log in or Create an account to join the conversation.