LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.75k stars 1.14k forks source link

Gmoccapy - Patch for Combination M61 + G4 #2489 - Version 2 #2841

Open zz912 opened 6 months ago

zz912 commented 6 months ago

This patch ensures that the automatic command G43 is not executed immediately, but when the LCNC is in IDLE mode.

zz912 commented 6 months ago

I would like to ask @gmoccapy and @hansu to review my patch proposal.

andypugh commented 6 months ago

The idea as described sounds fine, but I think we need Norbert (@gmoccapy ) to look at the code to be sure it will work without unintended side-effects.

zz912 commented 6 months ago

I agree with Andy. It will be good to wait for Norbert.

zz912 commented 5 months ago

I would like to add some more information about what this patch is good for. Currently, Gmoccapy behaves randomly when we want to change the tool with G43 active. Sometimes only a tool change is implemented. Sometimes a tool change is performed and the tool table window is closed.

I made two examples. In both cases I have G43 active and in both cases I change the tool from tool1 to tool10.

set_tool_variant1 set_tool_variant2

zz912 commented 4 months ago

@gmoccapy Can we at least add this Pull Request to the master branch? The master branch is still in development and could be tested.

gmoccapy commented 4 months ago

Please do not add this, I do only know one case where the actual way does not work. I do hope to have time to go on developing the GUI in about one year

zz912 commented 4 months ago

@gmoccapy I was thinking about: Gmoccapy - Patch for Combination M61 + G4 #2489 - Version 3

Replace MDI commands:

        if "G43" in self.active_gcodes and self.stat.task_mode != linuxcnc.MODE_AUTO:
            self.command.mode(linuxcnc.MODE_MDI)
            self.command.wait_complete()
            self.command.mdi("G43")
            self.command.wait_complete()

By changing the parameters: '5401-5409' - Tool Offsets for X, Y, Z, A, B, C, U, V & W. Set by G43. Volatile.

There would be no need to deal with problematic MDI mode switching.

Would it be acceptable to you if one of the experienced programmers did it?

I understand that you don't want push PR from an amateur like me. That I'm an amateur is a fact, it's not sarcasm.