My machine has only 5 axes, without the axis B and Y2 from the picture.
OK, That simplifies it a bit.
Unfortunately you have still have two independent coordinate systems. Also, unless I misunderstand, each spindle is capable of rotary positioning which would consume an axis. In this case your two coordinate systems would be: (X, Y, Z, C - Main Spindle) and (X2, Z2, C2 - Sub Spindle). This would bring you to a total of 7 coordinated axes (Y2 and B from the attached image no longer apply). Additionally, you will likely have two servos for live tooling that can be accomplished with Out of Band axes in Mach 4. This brings us up to a total of 9 axes.
In Swiss machines these typically act independently and at the same time, pausing only for synchronization when part exchange and cutoff is required.
As shown here (
https://www.machsupport.com/wp-content/uploads/2014/06/Mach%20Version%20Differences_doc_a9.pdf) Mach 4 only supports a single planner right now meaning that all motion would happen at the same time. In this way, you could still use the front and rear spindles, but the front would need to sit stationary while the back spindle is doing its thing. If you went with the 2 concurrent copies of Mach 4 running the machine, you could likely get the entire machine running as normal.
My problem now is that I don't really get along with LUA.
I was in that position 6 months ago. Today I really feel like I have a solid grasp on the language and can bend Mach 4 to do my will. There is no easy way to get there other than just working on it and asking a lot of questions here. There are some extremely knowledgeable people on this forum that are happy to help.
I would begin by reading through the reference material for LUA 5.3, the Mach 4 API documentation (in the Mach 4 docs folder on your computer), and maybe playing with the LUA online demo to test executing code.
You will absolutely need to be comfortable writing LUA scripts in order to interface with your machine. Users of very simple mills and lathes can use Mach 4 out of the box, but any "extra" functionality (ATC, powered drawbar, etc) needs to be scripted. The flexibility and customization offered by Mach 4 is one of it's biggest selling points in my mind.
I do not think that spindle-synchronization will be a big deal as long as, as long as mach4 will allow me to move simultaneously the Z and C axis.
Older Citizen machines have Z-axis synchronization and spindle rotation done in G code by the programmer.
Again, I don't have direct experience with converting a Swiss machine, I have to imagine that behind the scenes the control is doing something a little more complicated with speed matching the spindles. This is certainly able to be done if needed, otherwise we can just stick with running the axes from G-Code only and hoping they synchronize well enough.
My ambition is to be as close to the original as possible. I know it's a lot of work and a lot of money to invest but I hope something nice comes out of it.
Again, an awesome project. I really hope to see lots of updates about how this is coming along. Don't let me discourage you with the discussion above. Swiss machines have rather special CNC controls (same with wire EDM and mill turn machines) that we don't see much of in the hobby realm. Trying to think through the best way to recreate the functionality within the capabilities of Mach 4. Would love to see pictures of the machine you're working with.