Difficulty With applyMatrix, Matrix Values Coming From CAD System

I have data that i’m exporting from a CAD system and then importing into a THREE.js scene in the following way:

  1. Files (a.k.a parts) are getting translated to STLs

  2. Positioning of parts is exported as a 12 value array, where the last three values are the X,Y,Z location, and the first nine values are the rotation transformation values

  3. Importing the STLs using THREE.STLLoader

  4. Those imports come in as THREE.mesh objects

  5. The positioning information is read in via a JSON object

For a 12 value array “pos”, this line of code works (the mesh geometry is visible after positioning):

mesh.position.set(pos[9], pos[10], pos[11]);

As you can see in that line of code above, I’m only applying the translation values (X,Y,Z location).

If I try and apply all 12 values from the pos array in one fell swoop, I end up not seeing any geometry:

var mat = new Matrix4();

mat.set(
pos[0], pos[3], pos[6], pos[9],
pos[1], pos[4], pos[7], pos[10],
pos[2], pos[5], pos[8], pos[11],
0, 0, 0, 1
);

mesh.applyMatrix(mat);

Let me know if you see what I’m doing wrong.

What is the value of mesh.matrix after the .applyMatrix() call? Can you also provide the values of your pos array?

Hi
Im trying to do the same from my cad system;

  1. i’ve exported each part from my assembly cad file into single stl files
  2. i’ve exported all positions/rotations tree in a json file
  3. finally i’ve imported into browser through STLLoader.
    Positions work fine, but rotations not
    Is there a library available to use to reach this goal?
    What is the best technique?
    Thanks in advance
    Ruben