简体   繁体   English

IFCjs 在同一场景中添加不同的模型

[英]IFCjs add differents models in the same scene

I do not know if this would be the channel to ask a question that is happening to me in IFCjs.我不知道这是否会成为在 IFCjs 中向我提出问题的渠道。 I am trying to add two separate models that belong to the same work and these two are coming to me in different origins, when the coordinates of them should overlap and appear correlated.我正在尝试添加两个属于同一工作的单独模型,这两个模型来自不同的来源,当它们的坐标应该重叠并出现相关时。 I add the models as follows:我添加模型如下:

await this.ifcLoader.ifcManager.applyWebIfcConfig({
            COORDINATE_TO_ORIGIN: true,
            USE_FAST_BOOLS: true,
 });
this.ifcLoader.load(url, (ifcModel) => {     
            this.scene.add(ifcModel);
   });  

This is the result:这是结果:

在此处输入图像描述

But when use https://iloveifc.com/ : (image2)但是当使用https://iloveifc.com/ : (image2) 在此处输入图像描述

Are correlated.是相关的。

Would anyone know what I'm doing wrong?有谁知道我做错了什么?

What COORDINATE_TO_ORIGIN does is to take the first triangle found in the IFC and put it in the origin. COORDINATE_TO_ORIGIN所做的是将在 IFC 中找到的第一个三角形放入原点。 We are using that approach because that's the only reliable way in 100% of the IFC files.我们正在使用这种方法,因为这是 100% 的 IFC 文件中唯一可靠的方法。 To coordinate multiple models you can use that only in the first model, and then retrieve the transformation matrix applied to that model and apply it to the rest.要协调多个模型,您只能在第一个 model 中使用它,然后检索应用于该 model 的变换矩阵并将其应用于 rest。

let firstModel = true;

function loadIfc(url) {

  const settings = this.loader.ifcManager.state.webIfcSettings;
  const fastBools = settings?.USE_FAST_BOOLS || true;

  await loader.ifcManager.applyWebIfcConfig({
    COORDINATE_TO_ORIGIN: firstModel,
    USE_FAST_BOOLS: fastBools
  });

  const ifcModel = await loader.loadAsync(url, onProgress);

  if (firstModel) {
    const matrixArr = await 
    loader.ifcManager.ifcAPI.GetCoordinationMatrix(
      ifcModel.modelID
    );
    const matrix = new Matrix4().fromArray(matrixArr);
    loader.ifcManager.setupCoordinationMatrix(matrix);
  }

  firstModel = false;

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM