switching Z and Y

On 08/07/2013 at 13:22, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12 
Platform:    Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

My C4D to G-Code plugin is coming along. I am learning a lot and it's already producing some usable output.

But here is a more theoretical question I put off so far:
In C4D (and all other 3D software I have seen) the coordinate system is defined as X=width, Z=depth and Y=height. On a CNC machine (or rather in the software that runs it - in my case EMC2) X=width, Y=depth and Z=height. So Z and Y are switched.

The interface of my C4D plugin uses the CNC version which of course now that I am starting to use it a bit is becoming utterly confusing because it conflicts with the way C4D sees it.

I am looking for a solution and have a few ideas so far:

  1. the CNC machine of course could be rewired to exchange the Y and Z stepper motors. Which would be kicking the ball up the field. And the user shouldn't have to do that.

  2. somehow alter C4D to switch Z and Y - which in the end just means reorienting the "floor"

  3. leave everything as it is and build the models standing on their side (my plugin already has an export part and a tool to create a machine hierarchy so a 'Setup' tool could also work)

Any other ideas?



On 08/07/2013 at 17:12, xxxxxxxx wrote:

1. Use a matrix transform to change coordinate basis.

2. Be very careful with C4D's coordinate system.  Rotation uses HPB involving special calculations to avoid gimbal lock which can cause the rotation angles to vary wildly to maintain orientation.

Luckily for me, the only time that I had to deal with an external machine using C4D involved linear motions and no rotations.  If you can do the same with the CNC machine that would be the easiest.  For simple coordinate realignment, you could just assign the Y to Z and Z to Y between systems.

On 12/07/2013 at 13:52, xxxxxxxx wrote:

Thanks for the tips, Robert

I think I might do the design in C4D in the native coordinate system and on export create a temporary rotated copy (matrix transform for that)

I tried for a few days to use C4D, telling myself that the 'rear wall' is actually the 'floor'. Self-deception makes for poor trouble shooting.

A bigger problem is actually to come up with algorithms to cut more complex objects than rectangles.