Extension Autodesk Forge: My IFC 4 model can not connect to my extension

87 Views Asked by At

I uploaded my IFC version 4 to Autodesk forge and then added my extension, unfortunately, my control panel can not work and connect to my model. Also, I had this problem with the Revit model but solved it with a solution from Mr. Petr Broz.

Please check this (Extension Autodesk Forge: My control panel doesn't connect to the Revit model after adding my own extension to the package).

unfortunately, the solution for the Revit model doesn't work for the IFC4 model. Would you please Guide me on how I can solve it?

enter image description here

1

There are 1 best solutions below

2
On

I cannot see the full extension code from the thread you pointed out, but this problem should not be related to IFC4.

From your code snippet, I can see that there is a great possibility that thesetTransformation function would be called before the geometries are loaded completely. Before completely loaded geometries, fragment info like transform matrix, bounding box, and so on would not be completed. Therefore, I would advise you to setTransformation function after Autodesk.Viewing.GEOMETRY_LOADED_EVENT is triggered to avoid this problem.

if(model.isLoadDone() ) {
    viewer.addEventListner(
      `Autodesk.Viewing.GEOMETRY_LOADED_EVENT`,
      () => {
           this.setTransformation();
      }, { once: true }); //!<<< run this even handler once
} else {
  this.setTransformation();
}
  

Or call the async function viewer.waitForLoadDone() before calling setTransformation function to ensure geometries are loaded completely.

await viewer.waitForLoadDone();
this.setTransformation();