0

I'm having trouble loading different models in the viewer. I suspect the problem comes from mixing up different units (meters and millimeters) in the models.

So I have 3 Models:

  • IFC 1, is using millimeters as unit.

    • When loading the SVF derrivative into the viewer, doing

      console.log(model.getUnitScale(), model.getUnitString());

      outputs:

      0.001, mm

  • IFC 2, using millimeters as unit. Getting the same output as IFC 1

  • Obj. Model of a simple cube with center of cube at origin [0, 0, 0]. This does not seem to have any inherent unit.

    • When loading the SVF derrivative into the viewer, doing

      console.log(model.getUnitScale(), model.getUnitString());

      outputs:

      1, null

In order to load the models with the right coordinates I use the following options:

IFC 1 and 2:

{
    globalOffset: {x: 1000000, y: 100000, z: 7000},
    sharedPropertyDbPath: doc.getPropertyDbPath(),
}

Obj:

let mat = new THREE.Matrix4();
mat.makeTranslation(1000000, 100000,7000);

{
    placementTransform: mat,
    sharedPropertyDbPath: doc.getPropertyDbPath(),
}

The rationale here is that the IFC models are located far away from the origin, while the Obj model is located at origin. Using globalOffset for the IFCs seems necessary to get them to align in the viewer, using placementTransform is necessary to put the Obj close to the IFC models.

I'm struggling with the following problems here:

  • Navigating the models is hard, when highlighting the Obj model, it seems like it is set to using y-up or something, making it hard to do orientation navigation for the other models.
  • When trying to change zoom, only the Obj seems to be affected. Could this be due to different scale settings?

EDIT 1:

Looks like making the Obj cube the same size as the other models fixes the zooming problem. Also, if loading the IFC files first, the orientation navigation is right. It's only when loading the OBJ file first that we get the "y-up orientation" problem

Edit 2:

The orientation navigation problem can be fixed with viewer.navigation.setWorldUpVector(new THREE.Vector3(0,0,1), false);. Is it possible to also control behavior like this globally instead always letting the different models set the behavior?

1 Answer 1

1

I think the last loaded model will always have precedence over any previously set world-up vector. So if you want to control the world-up globally, you'll need to use the viewer.navigation.setWorldUpVector method manually after all the models have been loaded.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.