简体   繁体   English

使用 xbim 库创建自定义多边形墙

[英]create custom polygon wall using xbim library

I try to make ifc wall using some polygon points and save to ifc file.我尝试使用一些多边形点制作 ifc 墙并保存到 ifc 文件。

I found some approach and try that, but it does not work.我找到了一些方法并尝试了,但它不起作用。

here is my code:这是我的代码:

private static void CreateCustomPolygonWall(IfcStore model)
{
    using (var txn = model.BeginTransaction("Create Custom Polygon"))
    {
        List<double[]> points = new List<double[]>();
        points.Add(new double[] { 0, 0, 0 });
        points.Add(new double[] { 100, 0, 0 });
        points.Add(new double[] { 100, 100, 0 });

        var list = new List<IfcCartesianPoint>();
        foreach (var coordinates in points.Select(p => p.Select(x => new IfcLengthMeasure(x))))
        {
            var point = model.Instances.New<IfcCartesianPoint>();
            point.Coordinates.AddRange(coordinates);
            list.Add(point);
        }

        var faceSet = model.Instances.New<Xbim.Ifc4.TopologyResource.IfcConnectedFaceSet>();
        List<int[]> indexes = new List<int[]>();
        indexes.Add(new int[] { 0, 1, 2 });
        foreach (var t in indexes)
        {
            var polyLoop = model.Instances.New<Xbim.Ifc4.TopologyResource.IfcPolyLoop>();
            polyLoop.Polygon.AddRange(t.Select(k => list[k]));

            var bound = model.Instances.New<Xbim.Ifc4.TopologyResource.IfcFaceBound>();
            bound.Bound = polyLoop;

            var face = model.Instances.New<Xbim.Ifc4.TopologyResource.IfcFace>();
            face.Bounds.Add(bound);
            faceSet.CfsFaces.Add(face);
        }

        var surface = model.Instances.New<IfcFaceBasedSurfaceModel>();
        surface.FbsmFaces.Add(faceSet);

        txn.Commit();
    }
}

and if I save to ifc file following the code, the file has polygon points that I describe.如果我按照代码保存到 ifc 文件,则该文件具有我描述的多边形点。 but it is not showing any ifc viewer.但它没有显示任何 ifc 查看器。

#23=IFCCARTESIANPOINT((0.,0.,0.));
#24=IFCCARTESIANPOINT((100.,0.,0.));
#25=IFCCARTESIANPOINT((100.,100.,0.));

so how can I create a polygon wall and save it to ifc file using xbim library?那么如何使用 xbim 库创建多边形墙并将其保存到 ifc 文件?

any hint?任何提示?

best regards.此致。

You need to create more than just the geometry to create an IFC file which other viewers would process and display.您需要创建的不仅仅是几何图形来创建其他查看器将处理和显示的 IFC 文件。 Here is a working example of 3D wall creation.是 3D 墙创建的工作示例。 If you want to define the wall as any arbitrary profile, you would replace IfcRectangleProfileDef in the example with other profile definition , likely IfcArbitraryClosedProfileDef with OuterCurve being IfcPolyline .如果要将墙定义为任意轮廓,则可以将示例中的IfcRectangleProfileDef替换为其他轮廓定义,可能是IfcArbitraryClosedProfileDef ,其中OuterCurveIfcPolyline

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

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