Gcode preview and remap

More
3 years 1 month ago #281290 by zz912
Replied by zz912 on topic Gcode preview and remap
I tried make dirty fix:
 

Attachment not found



It dont work. Probably I need modification for Python 3 from Python.
 

Attachment not found



I would like ask you for help.

 

Please Log in to join the conversation.

More
3 years 1 month ago #281291 by rmu
Replied by rmu on topic Gcode preview and remap
it says right there at the end of the error message. In python, indentation is part of the syntax. It needs to say
Code:
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 to join the conversation.

More
3 years 1 month ago #281292 by Aciera
Replied by Aciera on topic Gcode preview and remap
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).

Please Log in to join the conversation.

More
3 years 1 month ago #281294 by zz912
Replied by zz912 on topic Gcode preview and remap

it says right there at the end of the error message. In python, indentation is part of the syntax. It needs to say
Code:
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.
It no longer gives the error message, but it didn't solve the problem. Still showing path of ATC. Still, thanks for the help.

Please Log in to join the conversation.

More
3 years 1 month ago #281295 by zz912
Replied by zz912 on topic Gcode preview and remap

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).

The same advice give me rene-dev.
github.com/LinuxCNC/linuxcnc/issues/2651...uecomment-1729335327
But I dont know how use #<_task>.
 

Please Log in to join the conversation.

More
3 years 1 month ago #281296 by zz912
Replied by zz912 on topic Gcode preview and remap
I tried this:
Code:
o<ATC> sub #<_task> = 1 G53 G1 Z-195 f20000 G53 G1 Z0 f20000 #<_task> = 0 o<ATC> endsub [10] m2 

But #<_task> is only readonly parameter.
 

Attachment not found

Please Log in to join the conversation.

More
3 years 1 month ago #281298 by Aciera
Replied by Aciera on topic Gcode preview and remap
This is an example from 'sim/axis/geometry/xyzc.ngc':
Code:
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 to join the conversation.

More
3 years 1 month ago #281299 by zz912
Replied by zz912 on topic Gcode preview and remap
I have absolutely no idea how this is going to help me. I don't understand why I have to check #<_task>. I need the ATC exchange to happen every time, not just depending on some parameter. I just need Preview to ignore it.

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 to join the conversation.

More
3 years 1 month ago #281300 by Aciera
Replied by Aciera on topic Gcode preview and remap
Try this:
Code:
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 to join the conversation.

More
3 years 1 month ago #281301 by Aciera
Replied by Aciera on topic Gcode preview and remap

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 to join the conversation.

Time to create page: 1.002 seconds
Powered by Kunena Forum