Macros Files for BB | Official Thread

This is a list of premade Macros for firmware 1.4.0 and up from Onefinity.

Since the 1.4 macro update is beta, consider these to be beta as well, as we’ve created them but haven’t tested the functionality of each one (ie: we may have made some human errors in our gcode writing :stuck_out_tongue: )

More info on the 1.4.0 firmware that introduced Macros:

How to install:

Click the macro you want to install from below. Place it on a usb stick like you would if you were going to run a file. Insert the usb drive into any port on the back of the BB controller. In the flyout menu, select MACROS. On the macro setting screen, click UPLOAD and choose the file you put on the pen drive. This will upload the code to that number macro you selected. Rename the macro in the name text box and choose a color from the color box to assign to the macro. Return to the control page and the macro should now be assigned.


Go to Home Position:

GoHomeXYZ.ngc (3 Bytes)


Parking:

  • Machinist (16x16):

ParkRearRightMachinist.ngc (21 Bytes)
ParkRearCenterMachinist.ngc (21 Bytes)

  • Woodworker (32x32):

ParkRearRightWoodworker.ngc (21 Bytes)
ParkRearCenterWoodworker.ngc (21 Bytes)

  • Journeyman (48x32):

ParkRearRightJourneyman.ngc (22 Bytes)
ParkRearCenterJourneyman.ngc (21 Bytes)

  • Foreman (48x48):

ParkRearRightForeman.ngc (23 Bytes)
ParkRearCenterForeman.ngc (22 Bytes)


Spindle:

TurnOnSpindle.ngc (8 Bytes)
TurnOffSpindleAndLaser.ngc (2 Bytes)
SpindleWarmUp1Minute.ngc (20 Bytes)


Laser:

FireLaser10Percent.ngc (7 Bytes)
TurnOffSpindleAndLaser.ngc (2 Bytes)


Vac:

VacOn.ngc (2 Bytes)
TurnOffVac.ngc (2 Bytes)


4 Likes

Reserve #1 for Onefinity

Reserve #2 for Onefinity

another future feature idea i had was inside the macro editor to be able to checkmark which tools it applies to, eg, Laser Material Test macro isn’t useful when using the Router/Spindle, and Vaccum isn’t useful for Laser, etc…

I also wonder if a default GoHomeXYZ might benefit from first raising Z during travel, then lowering upon arrival. something like G0 G90 X0 Y0 Z75; G0 G90 Z0; to avoid the inevitable classic clamp in the way bit breaking scenario :smiley:

I also wonder if there is a way to “toggle” a value in cgode, eg. turn vac off/on on alternate presses of the same macro.

Hey tmuka,

There exist two motion commands that first move to an intermediate coordinate, and only then to home or to an alternative position that you’ve set as predefined position. This is useful if you just milled inside a deep pocket, which is impossible to leave in the shortest way, in this case this command allows you to first let the router reach a higher position as intermediate position, and only then move to the final target coordinate. This command is called G28 or G30, but in order to use it, you need to have recorded the target final position before (unless you want it to be home, which is the default target). On the command line, you only give the intermediate position. If you give a Z axis value here, that can be seen as a sort of “safe height”.

Let’s assume that you have not set an alternative predefined position, in this case the default target position is the machine’s home position. This command goes this way:

G28 Z0

This will first lift Z to its topmost position which is 0 (Z goes from 0 to −133), and only then it will go to the predefined position (usually home position)

If you enter:

G91 G28 Z20

the prepended G91 (Set incremental distance mode) will make that value of the axis (here: 20) is interpreted as incremental value relative to the current position (instead of absolute machine value), so it would mean: “Lift Z by 20 mm from the current position, then go to the predefined postion (usally home position)”.

Cartesian coordinate system with right hand orientation


Schematic Representation of a CNC vertical milling center
– Source: Smid, Peter: CNC Programming Handbook , Industrial Press, South Norwalk, CT, USA, ISBN 9780831133474

See also here for CNC coordinate system and different positions for machine’s home.

2 Likes

@Aiph5u I’m so thankful for your wealth of knowledge, and generosity to share it! There is so much to learn, and i love learning. I’ll have to explore those commands further! Thank you.

2 Likes

I worked on this g-code last year sometime to easily find the middle of a workpiece by going to opposite corners and running the code. Now that MACROs exist, i’m excited I can assign it to a macro button called “Go to Midpoint”.

The g-code I figured out is

M70	; Save modal states
G54 G91 G0 X[#5420/-2] Y[#5421/-2] ; go to half the distance between current location and origin
M72	; Restore modal states

I’m not an expert, so by all means let me know if this can be improved!

I made a not-very concise video demo…

I’m also hoping I can figure out similar code to find the center of a circle based on three points on it.

5 Likes

Hey tmuka:

this will do what you intend:

G54 G91 G0 X-[#5420/2] Y-[#5421/2]

1 Like

@Aiph5u I appreciate the feedback! I did start with code that looked like that, but I think my g-code math works additionally to handle the case where the machine is at a negative location to the origin since dividing by the negative results in a positive relative move back toward the origin instead of away.

I did just learn about M70, M72 from your tool-change routine post, and I wrapped my MACRO in that too to make sure it doesn’t change any machine state. Thanks!

1 Like

Hey tmuka,

G54

; demo 1
G90 G0 Y100 Z-30 
G91 G0 Y-[#5421/2] Z-[#5422/2]

; demo 2
G90 G0 Y100 Z-30 
G91 G0 Y[#5421/-2] Z[#5422/-2]

Same results
(on my machine, only Z travel has negative values)

1 Like

I finally took the plunge and got the new firmware. Everything looks good. I installed a couple of the macros and they worked fine until I tried the journeyman park center macro. I got several soft limit errors. Machine was homed.

1 Like

What is the code to set the working “home” position? I have a Vacuum table and want to set XY zero at
X4 Y3 in a macro.
Thanks!

Hey Tony,

the g-code command sequence

G53 G0 X4 Y3

moves rapidly to X=4 and Y=3 in machine coordinates (no matter what coordinate system is in effect). If you want to be at a safe height prior to it you would add a preceding line that says

G53 G0 Z0

which will lift Z to the upmost position.

If you want to make the X=4 Y=3 (to which you moved rapidly above) your new workpiece zero, finally you do:

G92 X0 Y0

From this moment on, your X=4, Y=3 is the new X=0, Y=0.

Alternatively, if you don’t want to move to the new position but only set it your new workpiece zero, if you’re still at home position (or use G28 Z0 to go home with first lifting Z), you can simply enter:

G92 X-4 Y-3

From this moment on, your X=4, Y=3 is the new X=0, Y=0.

Explanation

G0 Move rapidly (if tool=laser, not firing)
G1 Linear Move at given feedrate (if tool=laser, firing)
F Set Feed rate

G90 Set Absolute Distance Mode – distances are meant to be in the active coordinate system
G91 Set Incremental Distance Mode – distances are meant to be relative to the coordinate you are at the moment

G53 Move in machine coordinates – no matter what coordinate system is in effect, it won’t change the latter.

:warning: IMPORTANT NOTE: Unlike the coordinate system commands G54–G59.3, G53 is not modal, it must be programmed on each line. G0 or G1 does not have to be programmed on the same line if one is currently active.

G92 Coordinate System Offset axes – makes the current point have the coordinates you want (without motion)

2 Likes

@Aiph5u Sorry long time no see,
Am just getting started with inlays and have a question about Z hgt.
Currently rough carve the plug with a 1/4 straight bit and start at Z0. Then detail carve with V bit starting with Z0 but have to run the detail carve again with Z-4, as the router cannot handle starting at V-4.
Would it be possible to write a macro so that when the Vbit gets to lets say Z-6 the program stops resets the Z start depth to Z-4 and starts the program from the beginning.
I am not ready yet to go into the detail cut code and re set the F command mid program.
PS wanted to PM you a note but for some reason I cannot seem to be able to.

Hey Tony,

I do not really understand what your problem is. If you have different passes with different bits, isn’t your CAM program dealing with the Z height correctly for the different passes?

It should be possible to send me PMs as others sometimes do. However when I try to send you a message, this is not possible. The error popup says: “Sorry, ynot is not accepting messages at the moment”. Did you configure something on your forum account that prevents private messages?

I think it may be a plot.
Cheers.

2 Likes

I have been working with the macros and it is a wonderful feature, I have a question about the macros and the Program Start code in settings.

Is it possible to run a macro without the Program_Start code running, or could this be an option that could be selected/deselected for each macro?

Another question about macros… can they call a sub function/program that is in the Program Start field in Settings? They trigger code in this field to run but can they call a specific function (O word). This could solve my previous question above.

Update: I tried just calling O3000 (the name of my subroutine in the Program Start) and it didnt execute anything at first and then realized that I needed to have “call” in there and it executed the subprogram.

The reason that I needed this is to have a series of subprograms that I am using for my ATC to open the dust cover that is using Load 2 (M08/M09) and to run a bit setter subprogram to get a new Z-offset.

I didnt want these programs called for every program start since the macros trigger the Program Start code and this is not desired for a handful of the macros that relate to laser and other non-ATC functions.

@OnefinityCNC
Is there a way to switch between Laser and Spindle/VFD with macros? Currently I have to go to the settings and into the tools menu to swap between the two. A macro to switch between the two would be awesome.

2 Likes