ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
604 stars 180 forks source link

Some Models is not displayed well and not show Properties #524

Closed pegreal closed 5 months ago

pegreal commented 11 months ago

Describe the bug 📝

I am testing the first non-alpha version of OBC (1.1.0) and I observe that some models IFC, are not displayed correctly, you can see an example in the image, also does not show the properties, in these cases that is not displayed well.

The code, is the one of the tutorial FragmentIfcLoader + ifcPropertiesProcessor but implemented in React.

left OBC, right web-ifc-viewer image

And the console, show the attached error for the properties. image

Testing IFC Model (Zipped for upload): XXXX_AARR.zip

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

Fedora Linux 38
AMD Ryzen 5 5625U with Radeon™ Graphics × 12
16 GBRAM
React + Vite
openbim-componentes 1.1.0

Used Package Manager 📦

npm

Error Trace/Logs 📃

index.ts:146 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'value') at _IfcPropertiesUtils.getEntityName (index.ts:146:37) at _IfcPropertiesProcessor.newEntityTree (index.ts:462:41) at _IfcPropertiesProcessor.newEntityUI (index.ts:294:28) at _IfcPropertiesProcessor.renderProperties (index.ts:268:21)

Validations ✅

pegreal commented 11 months ago

About the error on showing the Properties, I am not sure, but I think that:

On https://github.com/IFCjs/components/blob/main/src/ifc/IfcPropertiesUtils/index.ts:

static getEntityName(properties: IfcProperties, entityID: number) {
    const entity = properties[entityID];
    const key = Object.keys(entity).find((key) => key.endsWith("Name")) ?? null;
    const name = key ? (entity[key].value as string) : null;
    return { key, name };
  }

About the error that the properties are not shown, I am not completely sure, but I think that depending on the program that generates the IFC file, it does not generate the value attribute, if it is null, in the case of IfcRelDefinesByProperties, and I do not know if the same happens with the IfcPropertySingleValue. So it will generate the error at this point, I think it would be necessary to validate that the value attribute exists.

In the example file that I attached in the issue, it is an IFC generated by Civil3D, the same thing happens to me with other examples from Civil3D, both the error of the properties, and the problem of the visualisation.

It is an idea... :P

pegreal commented 11 months ago

@agviegas Regarding the wrinkled displayed models, several things come to my mind:

Thanks

HoyosJuan commented 8 months ago

I'm just following this thanks to some comments in the community, and just passing by to linking this issue with https://github.com/IFCjs/web-ifc/issues/504.

beachtom commented 5 months ago

I think this is now fixed at least the rendering elements - can you please re-open if not the case