I am currently working on a project that involves converting many parts within a single JT file to individual GLB files. I have written code to create all the GLBs, and I have code to put the GLBs together to view the rebuilt JT model.
The issue I am facing now is that the GLB files I create have a different rotation. So the ‘front’ of any original JT model becomes the ‘bottom’ of the rebuilt GLB model. Any idea why that would be?
I have tried setting a new rotation in several ways, mostly trying to apply a -90 degrees to the z-index. I’ve tried setting the rotation of the rootnode in a few different places like this:
scene.RootNode.Transform.EulerAngles = new Vector3(0, 0, 90);
But that doesn’t do anything. Are there other ways I can try to set the rotation of the GLBs I make?
I am using Aspose.3d 24.6.0 for .net . I’m not able to share the JT files I’m working with, but they are JT 9.5.
I can’t show the models, but I view the JTs / GLBs with CAD Assistant: image.png (14.7 KB)
The first image is the orientation of my original JT facing front image.png (11.0 KB)
The second image is Where I have to move the orientation so the model is facing its front
I want to write code to rotate the root of the GLB to fit that orientation. I have tried some things with Transform like my original post, but nothing changed.
This can be replicated with code like this:
public static void SaveAsGLB(string inputJTFile, string outputPath)
{
var scene = Scene.FromFile(inputJTFile);
scene.Save(outputPath + "converted.glb");
}
The converted GLB will have a different rotation from its original JT, the ‘front’ of the JT becomes the ‘bottom’ of the GLB
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): THREEDNET-1575
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
This worked for me! Transforming the children of the rootnode allowed my rotations to apply correctly.
n.Transform.EulerAngles = new Vector3(-90, 0, 0);
For tracking purposes, this is the transformation required to set our GLBs back to their normal orientation.
You may have to double check with other JT files, but my experience has been that saving JT to GLB conversions causes the GLB models to have a 90 degree X axis rotation applied to them (Based on EulerAngles).
@ajharf
You’re welcome, we’ve already provided axis system option in some file format’s save option classes, which is used to do manually axis system conversion during the saving.
We can also provide this in GLTF/GLB in the future if needed, especially used in the JT to GLB conversion, because the JT’s specification did not mention a valid axis/coordinate system for JT file.