简体   繁体   English

使用 GloabId 获取 object

[英]Get object with the GloabId

Is it possible to find an object in an IFC file using Xbim.Essentials with the GlobalId value?是否可以使用具有 GlobalId 值的 Xbim.Essentials 在 IFC 文件中找到 object? I saw this kind of code supposing I know the type...But I'd like to first find the object without knowing the type.我看到这种代码假设我知道类型......但我想先找到 object 而不知道类型。

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我认为您可以使用 IIfcProduct 接口

Xbim.Ifc4.Interfaces

like:喜欢:

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

should work on walls, slabs, columns etc...应该在墙壁,楼板,柱子等上工作......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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