Work Coordinate System, commanded spindle speed

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Work Coordinate System, commanded spindle speed

Postby Bagels » Fri Jun 05, 2020 4:37 am

Hey a few questions to tidy up my macros if anyone has suggestions that would be swell:

1) How do I pull the currently selected work coordinate system? ie, how to I find whether the currently selected coordinate system is G54, G55, G56 etc? I could pull from the UI work coordinate buttons and write a little code, but that seems extremely crude. I have a fixed cross laser offset from the spindle, and want to mark the offset as xy zero on macro call, but only in the currently selected work coordinate system.

2) I am running my spindle through Modbus (which, I may add, is so much cleaner than through analog control, always perfect closed loop speed control, no noise and tons of feedback on every VFD parameter) but this means that the standard M3/M5/S# commands don't actually do anything and seem to need some macro loving to function. I have a macroloop that pushes S# to the modbus register constantly, but the only place I could find the actual S value after override factors is on the UI...(2450 or 2451 or whatever) is there a cleaner way to pull that information? It just feels like a bit of an indirect solution. I just used the screen editor to click on the number and used that field number.

3) I have changed the M3 and M5 to push start/stop to the modbus register and wait until the status is confirmed from the VFD via another register. I have put stopspin() and dospinCW() in m5 and m3 respectively to let UCCNC know that the spindle is stopped/started. Are there other precautions I should take as good standard practice when running a spindle through modbus, or cleaner ways of doing this spindle setup? Not entirely sure what other hidden functions happen regarding spindle start/stop and speeds in the UCCNC background. I would like to tie the spindle into the estop as well, does a macroloop sound like the best way?

4) Can I get (or be pointed towards) an example of a yes/no button in action? Just a really simple box with text, and a yes and a no with a function tied to each button?

5) While the M3 and M5 are waiting for the spindle to confirm commanded speed via modbus I am using Wait(). What is the user locked out of during that wait period? I don't want any g-code/MDI/other macros being executed until the M3/M5 finishes resolving with either a success or an error message. If there is a comm error I would like to know before driving the bit into anything or probing something.

6) I would love to have the macroloop check and see if the actual spindle speed is different than commanded and feedhold until they match. Ie, if a new S# command is issued, don't keep cutting until it is actually reached. Can anyone think of reasons why this will or will not work, or if there is a particularly clean way of doing this?

I guess I am not sure what best practice is for UCCNC macros and am trying to keep things clean and organized.

Thanks all! I am really loving how easy it is to use macros to fine tune the machine!
Posts: 9
Joined: Thu May 21, 2020 6:09 pm

Re: Work Coordinate System, commanded spindle speed

Postby Bagels » Sun Jun 07, 2020 3:28 pm


1) Is super easy, just change the fields and validate it, feel kinda dumb for not realizing that.

Any thoughts on any other items? I'm sure there are others running Modbus and am very curious how they set their systems up.
Posts: 9
Joined: Thu May 21, 2020 6:09 pm

Return to Macros

Who is online

Users browsing this forum: No registered users and 1 guest