Rhino C++ Export Plugin : Horizontal flip issue, exported object looks flipped?

Hi !

While working with C++ to make a plugin for Rhino to export the model to another file format, I am facing an issue.

So, the original model in Rhino looks like:

And, the exported model looks like this:

So, as you can clearly see, everything on the X-axis (Horizontal axis) looks flipped.

A point to note, is that the exported model is for a 3D viewer software, which also uses the same co-ordinate system as Rhino (Y-up) and it is based on the Unreal engine. So I don’t get why this is happening.

Would appreciate some tips on how to fix this, and why is this happening.

Hi @binigya,

Other than seeing the visual differences, you haven’t provide enough information for us to make any suggestions.

Are you transforming the Rhino geometry before exporting?

– Dale

Hey @dale,

Sorry about not providing enough information, here is the way I am exporting the 3dm model :

  1. First, I generate the meshes, using the RhinoMeshObjects() function, and then iterate through the generated meshes array to get the required data like, vertices, uv co-ordinates, etc. Also, I convert the quads to triangles using currentONMesh->ConvertQuadsToTriangles();

  2. I get all the data I require from the m_T, m_V, m_N arrays, which I save into a file. I also iterate thorugh the faces to get the mesh indices data.

  3. From then on, I use the object iterator to get all the object related data, such as UUID, name, which mesh it is associated to, and so on.

  1. And yeah, regarding that, after I get all this data, these are the values I use to define the transformation of the Rhino objects:

// Transformation
ON_3dVector objPosition = ON_3dVector(0.0, 0.0, 0.0);
ON_3dVector objScale = ON_3dVector(1.0, 1.0, 1.0);
ON_Quaternion objRotation = ON_Quaternion(0.0, 0.0, 0.0, 1.0);

So, after that I just get the data about the materials and the textures, file details, and so on, which I guess aren’t vital in this context?

So, @dale, what approach should I take to ensure that the models don’t end up flipped? I am kind of clueless as the co-ordinate system of Unreal and Rhino are same, and I don’t know how to proceed from now on ?

Also, please let me know if the information I’ve given is enough or should I post more details and screenshots?

Hi @binigya,

Sorry - I’m not sure how to help.

Is there a reason you don’t just use DataSmith?

https://docs.unrealengine.com/en-us/Studio/Datasmith/SoftwareInteropGuides/Rhino

– Dale