简体   繁体   English

使用 XBIM 从 IFC 文件获取墙坐标

[英]Getting the wall coordinates from IFC file with XBIM

I need to get the list of vertices of IfcWall object using XBIM.我需要使用 XBIM 获取 IfcWall 对象的顶点列表。 The code i need must look something like:我需要的代码必须类似于:

using (model)
{
    List<ItemSet<IfcCartesianPoints>> loppsList = new List<ItemSet<IfcCartesianPoints>>();
    var walls = model.Instances.OfType<IfcWall>();

    foreach (var wall in walls)
    {
        loppsList.Add(wall. ... .Points);
    }
}

But i have no idea, how to get the proper way .但我不知道如何获得正确的方法。

I tried the solution proposed here: IFC objects navigation to retrieve Wall coordinates我尝试了这里提出的解决方案: IFC objects navigation toretrieve Wall坐标

foreach (var wall in walls)
{
    var line = wall.Representation.Representations[0].Items[0];
    var _line  = line as IfcPolyline;
    loppsList.Add(_line.Points);
}

But i didn't get the proper data — maybe I just got lost in the path of attributes.但是我没有得到正确的数据——也许我只是在属性路径中迷路了。 Please help to navigate through the IfcWall attributes.请帮助浏览 IfcWall 属性。

Ok, if someone in future will face the same question, the full way is:好吧,如果将来有人会面临同样的问题,完整的方法是:

wall.Representation.Representations[].Items[].Outer[].CfsFaces[].Bounds[].Bound.Polygon[] wall.Representation.Representations[].Items[].Outer[].CfsFaces[].Bounds[].Bound.Polygon[]

//this is how i print the x coordinates of all points
using (model)
        {

            var walls = model.Instances.OfType<IIfcWall>();

            foreach (var wall in walls)
            {
                var loop = wall.Representation.Representations[1].Items[0];

                if (loop is IfcFacetedBrep)
                {

                    var _loop = loop as IfcFacetedBrep;
                    foreach (var face in _loop.Outer.CfsFaces)
                    {
                        foreach (var bound in face.Bounds)
                        {
                            var _b = bound.Bound as IIfcPolyLoop;
                            foreach (var point in _b.Polygon)
                            {
                                Debug.WriteLine(point.ToString());
                            }
                        }
                    }
                }
            }
        }

But:但:

  1. Representations[] element must be IfcFacetedBrep (if it is IfcBooleanClippingResult, then i have no idea what to do) Representations[] 元素必须是 IfcFacetedBrep(如果是 IfcBooleanClippingResult,那么我不知道该怎么做)

  2. Indexes of the Representations[], Items[] and other arrays are unknon Representations[]、Items[] 和其他数组的索引是未知的

  3. Walls can be as IfcWall (IFC 4), as IIfcWall (IFC 2x3) and the navigation through this objects are different墙壁可以是 IfcWall (IFC 4),因为 IIfcWall (IFC 2x3) 和通过这个对象的导航是不同的

Do not use IFC.不要使用国际金融公司。

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

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