GltfSerializers icon indicating copy to clipboard operation
GltfSerializers copied to clipboard

Access element properties

Open OliHas opened this issue 7 years ago • 4 comments

Hi! For a researchproject I'm developping a small three.js viewer, in which BIM models from the BIMServer can be displayed. Now I would like to get the properties of an element directly in the three.js-viewer. Is there a way to access properties of a selected element? Something like a unique id, which is passed from the GltfSerializer? Thanks for your help!

OliHas avatar Jun 05 '18 14:06 OliHas

So far I have not come across the ability to add custom data in a glTF (2) file (in the specification). If you know of a place where we could put for example the IfcProduct id, please let me know and I'll add it to the serializer.

rubendel avatar Jun 08 '18 07:06 rubendel

I think this could help: GLTFLoader: Fixes to improve mesh name uniqueness. I recommend to store the IfcProduct id here: primitive[].extras This becomes in three.js: mesh[].userData

OliHas avatar Jun 11 '18 06:06 OliHas

Hi! It is possible to pass data if this is inserted into the code "BinaryGltfSerializer2.java" at line 558:

ObjectNode extrasNode = OBJECT_MAPPER.createObjectNode();
nodeNode.set("extras", extrasNode);
extrasNode.put("IfcProductID", IfcProductID);

How do I find out the IfcProduct id? Thanks for your help!

OliHas avatar Jun 13 '18 16:06 OliHas

Cool.

https://github.com/opensourceBIM/GltfSerializers/blob/master/Gltf/src/org/bimserver/gltf/BinaryGltfSerializer2.java#L200

The ifcProduct.getOid() will give you the product oid.

rubendel avatar Jun 14 '18 11:06 rubendel