# Macros Files for BB | Official Thread

**URL:** <https://forum.onefinitycnc.com/t/macros-files-for-bb-official-thread/25091>\
**Category:** Macros for BB\
**Created:** [February 2, 2024, 4:26pm UTC](https://forum.onefinitycnc.com/t/macros-files-for-bb-official-thread/25091 "2024-02-02T16:26:39Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![tmuka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.onefinitycnc.com/tmuka/32/7525_2.png) [@tmuka](https://forum.onefinitycnc.com/u/tmuka)\
**Post date:** [February 27, 2024, 2:33am UTC](https://forum.onefinitycnc.com/t/macros-files-for-bb-official-thread/25091/8 "2024-02-27T02:33:01Z")

</div>

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

```auto
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…

[![](https://us1.discourse-cdn.com/flex022/uploads/onefinitycnc/original/3X/1/1/111e3a367e8c1b3f928ef43d60ebdefde7e3dc07.jpeg "Onefinity Buildbotics 1.4.0 Alpha 2 Midpoint Macro") ](https://www.youtube.com/watch?v=buR1PCdSZ0M&t=57)

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

---

_[View the full topic](https://forum.onefinitycnc.com/t/macros-files-for-bb-official-thread/25091)._
