synman / Octoprint-Bettergrblsupport

Better Grbl Support Plugin for Octoprint based (loosely) on the original Grbl Support plugin developed by mic159
https://github.com/synman/Octoprint-Bettergrblsupport/wiki
64 stars 19 forks source link

Multiple Work coordinate systems #78

Closed AlexonCNC closed 2 years ago

AlexonCNC commented 2 years ago

It would be great to be able to set several work coordinate systems (i.e. G54, G55, G56, etc..) and select one of them to make it active for a specific job. A drop down menu could be added when selecting the mode, listing the various coordinate systems.

synman commented 2 years ago

Something like this?

Screen Shot 2022-01-29 at 1 11 43 PM
synman commented 2 years ago

this is in the dev channel.... will cut a release candidate for 2.2.1 tonight and target mid week for a stable release

synman commented 2 years ago

just realized I need update home for this to truly work...

        if direction == "home":
            self._printer.commands(["G54", "G90"])

            if axis == "X":
                self._printer.commands(["G0 X0", "G91"])
            elif axis == "Y":
                self._printer.commands(["G0 Y0", "G91"])
            elif axis == "Z":
                self._printer.commands(["G0 Z0", "G91"])
            elif axis == "XY":
                self._printer.commands(["G0 X0 Y0", "G91"])
            else:
                self._printer.commands(["G0 X0 Y0 Z0", "G91"])

this fix (I'll take care of it a little later today) should be as simple as dropping G54" from the top of the sequence as we now have the widget for coordinate system selection

synman commented 2 years ago

grr... forgot about G10

AlexonCNC commented 2 years ago

Woaow ! That was quick ! Cannot help much on the code as I'm very new and on discovery to CNC. This looks promessing though ! Looking forward to see it implemented. Many thanks for this quick upgrade ! :-)

synman commented 2 years ago

almost done. I'm pushing these changes directly to dev channel while I'm making them so I can test on my CNC.

I usually test locally on my laser before pushing to the dev remote but I've got my laser module precariously resting on its Y gantry right now and I'm too lazy to run downstairs to secure it.

I'm 99% sure my next remote push will have the finished code.

AlexonCNC commented 2 years ago

Actually, these coordinates are linked to the position of the machine. In terms of layout, I was envisionning these buttons close to the machine position values. Selecting G54 should update the X, Y, Z position numbers as it relates to the G54 0;0;0 position, right ?

AlexonCNC commented 2 years ago

That's great - thanks !

synman commented 2 years ago

I'm leveraging the built in GRBL work coordinate systems for this. I previously had work origin tied to G54 and this was on my list of todos. your request motivated me to get it out of the way.

synman commented 2 years ago

as a best practice your job should set whatever system it wants to use in its preamble / header, but yeah, if it doesn't it will use which system is active when the job starts.

synman commented 2 years ago

it's kind of a big deal too ... I'd been meaning to do this forever

AlexonCNC commented 2 years ago

So, should this be parametered when you create your gcode file, from the toolpath CAM program ?

synman commented 2 years ago

that's one way to do it if your post processor supports it. most just use whichever system is active.

AlexonCNC commented 2 years ago

ok.. still lots to learn !! :-)

synman commented 2 years ago

"real" CNC operators use these systems to setup offsets for multiple copies of the same "object". For each "copy" of the job they change the coordinate systems to offset "home".

After placing their work piece / material, they step through each system setting its "home" wherever they want that "copy" to cut.

synman commented 2 years ago

if this pops back open you'll know I found another bug lol

AlexonCNC commented 2 years ago

In any case, I was very happy to find this better grbl add-on. I use Octoprint on my 3D printer and I was desperately looking for a software that could do the same on my CNC. Ok, I understand. In my case, I can use a milling bit or a laser on my machine. I'm planning on just swapping them depending on the job. That's why I was interested in the enhancement. And for more flexibility too... I'll upload it when available and let you know how it works for me ! Have a good one and many thanks for your help !

synman commented 2 years ago

you can use them however you like. no one can judge you if you don't tell them :)

I think just about everyone who uses BGS does so because they came from the 3d printer world. That was what motivated me to create it.

synman commented 2 years ago

oh, one last item.... these systems tie directly to the mode status readout in the Grbl Control tab. Clicking on Mode will toggle between WPos and MPos for coordinate reporting. If you put your machine in WPos reporting mode (by clicking the Mode readout) you'll be able to see how each relates to its own system. MPos will always give you your coordinates in the machine coordinate system.

AlexonCNC commented 2 years ago

Yes, that is what I meant in an earlier comment, but I did not express myself very clearly. That's how I thought this would be working. In fact, I had initially in mind that you could toggle from MPo to G54WPo, to G55WPo, etc by clicking the Mode readout. But the way you've come up with it is perfect.

AlexonCNC commented 2 years ago

Hi Synman, Just wanted to thank you for this enahncement. It seems to work just perfectly ! Best regards Alex

synman commented 2 years ago

It had been in the "ideation" phase (translation: in my brain) for a while. Thank you for the nudge to get it out there for all us to use!