簡體   English   中英

使用 XBIM 從 IFC 文件獲取牆坐標

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

我需要使用 XBIM 獲取 IfcWall 對象的頂點列表。 我需要的代碼必須類似於:

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);
    }
}

但我不知道如何獲得正確的方法。

我嘗試了這里提出的解決方案: 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);
}

但是我沒有得到正確的數據——也許我只是在屬性路徑中迷路了。 請幫助瀏覽 IfcWall 屬性。

好吧,如果將來有人會面臨同樣的問題,完整的方法是:

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());
                            }
                        }
                    }
                }
            }
        }

但:

  1. Representations[] 元素必須是 IfcFacetedBrep(如果是 IfcBooleanClippingResult,那么我不知道該怎么做)

  2. Representations[]、Items[] 和其他數組的索引是未知的

  3. 牆壁可以是 IfcWall (IFC 4),因為 IIfcWall (IFC 2x3) 和通過這個對象的導航是不同的

不要使用國際金融公司。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM