xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
714 stars 286 forks source link

[FEATURE SUGGESTION] Track IfcMaterial in metadata #1130

Open g-rodigy opened 1 year ago

g-rodigy commented 1 year ago

It's possible to get material value on object? From metaObject or other way. In this example it is STEEL/--

image

g-rodigy commented 10 months ago

Use web-ifc I can find Lines with type IFCMATERIAL. Is this data available in xkt file and/or can write it easy to xkt? Some example with web-ifc in nodejs:

const {IfcAPI, IFCMATERIAL, IFCRELASSOCIATESMATERIAL}  = require("./web-ifc/web-ifc-api-node.js")
const ifcApi = new IfcAPI()
await ifcApi.Init()
const modelID = ifcApi.OpenModel(file)
const materials = ifcApi.GetLineIDsWithType(modelID, IFCMATERIAL, false)
const associates = ifcApi.GetLineIDsWithType(modelID, IFCRELASSOCIATESMATERIAL, false)

// In this example materials.get(0) is 'STEEL/--'
const materialLine = ifcApi.GetLine(modelID, materials.get(0))

for (let i = 0; i < associates.size(); i++) {
    const assoc = ifcApi.GetLine(modelID, associates.get(i))
    // Then can filter each assoc by material assoc.RelatingMaterial and get needed objects assoc.RelatedObjects
}

ifcApi.CloseModel(modelID);

Maybe has easy way to find object from example code.

xeolabs commented 4 months ago

This is not currently supported, but I will however change this issue to a FEATURE SUGGESTION so we can track it as such. Thanks