简体   繁体   中英

Get object with the GloabId

Is it possible to find an object in an IFC file using Xbim.Essentials with the GlobalId value? I saw this kind of code supposing I know the type...But I'd like to first find the object without knowing the type.

var id = "2AswZfru1AdAiKfEdrNPnu";
var theDoor = model.Instances.FirstOrDefault<IIfcDoor>(d => d.GlobalId == id);
Console.WriteLine($"Door ID: {theDoor.GlobalId}, Name: {theDoor.Name}");

I think you can use IIfcProduct interface from

Xbim.Ifc4.Interfaces

like:

var ifcProduct = model.Instances.FirstOrDefault<IIfcProduct>(d => d.GlobalId == id);

should work on walls, slabs, columns etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM