It is a matter to grind the tool to the square shape.

The issue would be how to do the female part.[

]
In the pic you see a triangular shape tool performing a M-4x70 on my lathe. The thread rod is for convert a BVM gear to electric one
Total cost of the conversion 110 € included the electronics
Sorry, the thread is M-4x70