engine_web-ifc icon indicating copy to clipboard operation
engine_web-ifc copied to clipboard

Display IfcGridAxis

Open rvouilloz opened this issue 3 years ago • 8 comments

The IFC files have their own grid axes drawn directly in the model. Could we display them as lines (dotted?) with their names as well? I did a test here by exporting them as a separate gltf and displaying the name as CSS2DObject :
2

const ifcGridLoader = new GLTFLoader();
  ifcGridLoader.load("../5-grid/IfcGrid.glb", function (gltf) {
    const model = gltf.scene;
    model.traverse(function (child) {
      if (child instanceof Line) {
        const ifcGridAxisName = child.name;
        const ifcGridAxisShortName = ifcGridAxisName.substring(
          ifcGridAxisName.lastIndexOf("IfcGridAxis") + 11
        );
        const firstLabel = document.createElement("span");
        firstLabel.textContent = ifcGridAxisShortName;
        const ifcGridAxisFirstLabel = new CSS2DObject(firstLabel);
        ifcGridAxisFirstLabel.position.set(
          child.geometry.attributes.position.array[0],
          child.geometry.attributes.position.array[1],
          child.geometry.attributes.position.array[2]
        );
        viewer.context.getScene().add(ifcGridAxisFirstLabel);
        const secondLabel = document.createElement("span");
        secondLabel.textContent = ifcGridAxisShortName;
        const ifcGridAxisSecondLabel = new CSS2DObject(secondLabel);
        ifcGridAxisSecondLabel.position.set(
          child.geometry.attributes.position.array[3],
          child.geometry.attributes.position.array[4],
          child.geometry.attributes.position.array[5]
        );
        viewer.context.getScene().add(ifcGridAxisSecondLabel);
      }
    });
    viewer.context.getScene().add(model);
  });

rvouilloz avatar Oct 28 '22 07:10 rvouilloz

The main work to do in web-ifc here is we have no way to get the 2d geomety directly out - we need some functionality to allow us to call GetGometry with an express ID of some 2D element

beachtom avatar May 02 '23 19:05 beachtom

@beachtom Is there a way to generate 2d geometries (like IfcGrid and IfcAnnotation)? This is a common case that additional infos were placed as annotations in a model. What do you think?

pbbr avatar May 04 '23 07:05 pbbr

Yeah it should be possible - we just don't expose it to the typescript interface in any way - so it will need some work

beachtom avatar May 04 '23 08:05 beachtom

@beachtom That would be very nice! Do you have any plans / timeline to do this?

pbbr avatar May 04 '23 11:05 pbbr

@beachtom Do you have any updates on this? It would be very useful to have 2D geometries available to replace tranditional drawings and extend models with annotations. Thanks a lot!

pbbr avatar Jun 07 '23 07:06 pbbr

No update yet I am afraid. There is a need to some some refactoring to expose the 2d geometries - which is in progress - but not ready yet

beachtom avatar Jun 07 '23 07:06 beachtom

Thanks a lot for your effort!

pbbr avatar Jun 07 '23 07:06 pbbr