Skip to main content

IfcGeometryBuilder

Represents a builder for creating geometries from IFC product meshes.

Index

Properties

publicreadonlygeometryBuildId

geometryBuildId: number

The ID of the geometry build.

publicreadonlyloaderElements

loaderElements: BimIfcLoaderElement[]

The loader elements to build geometries from.

publicstaticreadonlyoptions

Options to control for how long the geometry builder should execute before sleeping when performing heavy operations such as create and build. These options can be useful to avoid blocking the main thread for too long. Decreasing deadlineMs and sleepInMs will make the operations faster but will also increase the risk of blocking the main thread for too long. Increasing makes the main thread (UI) more responsive but the operations will take longer to complete.

Accessors

publicgeometryCount

  • get geometryCount(): number
  • The number of geometries that will be built when build is called.


    Returns number

    The number of geometries.

publicifcProductMeshCount

  • get ifcProductMeshCount(): number
  • The number of IFC product meshes this builder will build geometries for.


    Returns number

    The number of meshes.

publicindiceCount

  • get indiceCount(): number
  • Gets the number of indices in the geometry. The number of triangles in the geometry is this number divided by 3.


    Returns number

    The total number of indices.

Methods

publicbuild

  • Builds Geometry3d instance from all BimProduct instances that was included during the call to create. This is a very CPU intensive operation.

    @remarks

    Only access the Geometry3d instance inside the action callback. The Geometry3d instance, and all data accessable trhoug it, will be invalid after the action callback has been invoked. Each Geometry3d instance will contain the geometry from all BimProductMesh instances that share the same mergeId.


    Parameters

    Returns Promise<Geometry3dHandle[]>

    A promise that resolves to an array of Geometry3dHandle objects. These can be used to unload the geometries from TwinfinityViewer by calling removeMesh.

publicstaticcreate

  • Creates an instance of IfcGeometryBuilder.

    @remarks

    The create method will traverse all BimProduct instances provided by o.loaderElements.entries(). Each BimProduct that has geometry, not all products do, has N BimProductMesh instances. The create method will visit each such instance and assign a mergeId to each of them. This mergeId will be identical for BimProductMesh instances that shall be merged into the same Geometry3d instance when build is called. BimProductMesh instances that alredy have a mergeId will be ignored as it is assumed that has already been processed by another IfcGeometryBuilder instance. It is also possible to ignore certain BimProduct instances by providing a predicate function in o.predicate. This will allow the caller to filter out products that should not be included in the geometry creation. For example, one might want to only include IFC products that are of a certain type or have a certain property set. Specifying a predicate function allows for this.

    When a IfcGeometryBuilder instance has been created, the caller can call build to start the geometry creation process. This is a very CPU intensive process.

    One should always attempt to use as few IfcGeometryBuilder instances, to create Geometry3d instances, as possible. The more Geometry3d instances that we add to TwinfinityViewer, by calling TwinfinityViewer.addGeometry, the worse rendering performance we will get. This is because the more geometries we have the more draw calls we will have. The more draw calls we have the worse performance we will get. There is no fixed number of geometries that is the limit. It depends on the hardware and the complexity of the geometries.


    Parameters

    Returns Promise<IfcGeometryBuilder>

    A promise that resolves to an instance of IfcGeometryBuilder.