engine_components icon indicating copy to clipboard operation
engine_components copied to clipboard

Make jsonExporter.export call configurable for export

Open wlinna opened this issue 11 months ago • 0 comments

Description 📝

As a (BIM) developer using thatopen/components, I want to be able to have indirect properties available. However, right now there are no configuration options that would make IfcLoader.load call IfcJsonExporter.export such that the third parameter indirect is set to true. Instead, it will use its default argument `

https://github.com/ThatOpen/engine_components/blob/7592f29a0e187f256ff89036739ef2f1d64b4172/packages/core/src/fragments/IfcLoader/index.ts#L127

Suggested solution 💡

I think IfcLoader.load should have an options object argument that could be used to pass not only the existing options such as name, coordinate, but also includeIndirectProperties which would be passed to jsonExporter.export. The new load would look like this:

export interface LoadOptions {
    coordinate: boolean;
    name: string;
    includeIndirectProperties: boolean
}

...

async load(data: Uint8Array, options:  LoadOptions) {
     ...
    const properties = await jsonExporter.export(this.webIfc, 0, options.includeIndirectProperties ?? false);
    ...
}

Alternative ⛕

Another alternative is to just add fourth parameter to load, but that would become unwieldy. Or as a compromise, the fourth parameter could be an object.

Yet another alternative is to add an option to IfcFragmentSettings.

Monkey-patching load might be possible, but that requires copying both load and SpatialIdsFinder.get .

It might be possible to just call IfcJsonExporter yourself, but then you'd have both the properties that load originally loaded and the ones you exported yourself in RAM, not to mention that it takes extra CPU time to generate both.

Additional context ☝️

No response

Validations ✅

  • [x] Read the docs.
  • [x] Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

wlinna avatar Feb 08 '25 21:02 wlinna