From 20fb1cf7bd1a6eac3712d05aec12290d2a756fe0 Mon Sep 17 00:00:00 2001 From: ogorhc Date: Tue, 25 Feb 2025 13:59:04 +0100 Subject: [PATCH] feat(obc): show the material profile in ElementProperties component --- .../ElementProperties/src/materials-row.ts | 33 +++++++++++++++++++ .../tables/ElementProperties/src/template.ts | 11 ++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/packages/obc/src/components/tables/ElementProperties/src/materials-row.ts b/packages/obc/src/components/tables/ElementProperties/src/materials-row.ts index 452b1569..42c9a8ed 100644 --- a/packages/obc/src/components/tables/ElementProperties/src/materials-row.ts +++ b/packages/obc/src/components/tables/ElementProperties/src/materials-row.ts @@ -44,6 +44,39 @@ export const createMaterialsRow = async ( row.children.push(layerRow); } } + if (material.type === WEBIFC.IFCMATERIALPROFILESETUSAGE) { + const profileSetID = material.ForProfileSet?.value; + const profileSetAttrs = await model.getProperties(profileSetID); + if (!profileSetAttrs) continue; + for (const profileHandle of profileSetAttrs.MaterialProfiles) { + const { value: profileID } = profileHandle; + const profileAttrs = await model.getProperties(profileID); + if (!profileAttrs) continue; + const materialAttrs = await model.getProperties(profileAttrs.Material?.value); + if (!materialAttrs) continue; + const profileRow = { + data: { + Name: "Profile", + }, + children: [ + { + data: { + Name: "Name", + Value: profileAttrs.Name?.value, + }, + }, + { + data: { + Name: "Material", + Value: materialAttrs.Name?.value, + }, + }, + ], + }; + if (!row.children) row.children = []; + row.children.push(profileRow); + } + } if (material.type === WEBIFC.IFCMATERIALLIST) { for (const materialHandle of material.Materials) { const { value: materialID } = materialHandle; diff --git a/packages/obc/src/components/tables/ElementProperties/src/template.ts b/packages/obc/src/components/tables/ElementProperties/src/template.ts index af75042b..f6eca3aa 100644 --- a/packages/obc/src/components/tables/ElementProperties/src/template.ts +++ b/packages/obc/src/components/tables/ElementProperties/src/template.ts @@ -108,11 +108,12 @@ const processAssociateRelations = async ( classifications.push(attrs); } if ( - attrs.type === WEBIFC.IFCMATERIALLAYERSETUSAGE || - attrs.type === WEBIFC.IFCMATERIALLAYERSET || - attrs.type === WEBIFC.IFCMATERIALLAYER || - attrs.type === WEBIFC.IFCMATERIAL || - attrs.type === WEBIFC.IFCMATERIALLIST + [ + WEBIFC.IFCMATERIALLAYERSETUSAGE, + WEBIFC.IFCMATERIAL, + WEBIFC.IFCMATERIALLIST, + WEBIFC.IFCMATERIALPROFILESETUSAGE, + ].includes(attrs.type) ) { materials.push(attrs); }