0

我的要求是使用GeometryGym读取现有的 IFC 文件并向其中添加新对象。所以我写了一个C#代码如下,

public void CreateDocuemntRefIcon(string filePath)
{
       DatabaseIfc db = new DatabaseIfc(filePath);
       IfcProject project = db.Project;
       List<IfcBuilding> buildings = project.Extract<IfcBuilding>();
       IfcBuilding thisBuilding = buildings.FirstOrDefault();

       //Creating cube object 
       List<Coord3d> points = new List<Coord3d>() {
             new Coord3d(0, 0, 0), new Coord3d(10, 0, 0),
             new Coord3d(10, 10, 0), new Coord3d(0, 10, 0),
             new Coord3d(0, 0, 10), new Coord3d(10, 0, 10),
             new Coord3d(10, 10, 10), new Coord3d(0, 10, 10) };


       IfcCartesianPointList3D cartesianPointList3D = new IfcCartesianPointList3D(db, points);

        List<CoordIndex> coordIndex = new List<CoordIndex>() {
                new CoordIndex(1, 6, 5), new CoordIndex(1, 2, 6), new CoordIndex(6, 2, 7),
                new CoordIndex(7, 2, 3), new CoordIndex(7, 8, 6), new CoordIndex(6, 8, 5),
                new CoordIndex(5, 8, 1), new CoordIndex(1, 8, 4), new CoordIndex(4, 2, 1),
                new CoordIndex(2, 4, 3), new CoordIndex(4, 8, 7), new CoordIndex(7, 3, 4)
         };

         IfcTriangulatedFaceSet triangulatedFaceSet = new IfcTriangulatedFaceSet(cartesianPointList3D, true, coordIndex);
         IfcColourRgbList colourRgbList = new IfcColourRgbList(db, new List<Color>() { Color.Red, Color.Green, Color.Yellow });
         IfcIndexedColourMap indexedColourMap = new IfcIndexedColourMap(triangulatedFaceSet, colourRgbList, new List<int>() { 1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1 });

         IfcBuildingElementProxy buildingElementProxy =
                    new IfcBuildingElementProxy(thisBuilding, null, new IfcProductDefinitionShape(new IfcShapeRepresentation(triangulatedFaceSet)));

         //Writed the file
         db.WriteFile(string.Format("{0}.ifc", "EditedIFC"));
}

这适用于IFC4 版本。但不适用于IFC2x3 版本。可能是什么问题 ?

4

1 回答 1

0

IFC2X3 没有 IfcTriangulatedFaceSet。这已添加到 IFC4。

您可以使用 IFC2X3 下的 IfcShellBasedSurfaceModel 模拟三角曲面。

于 2018-05-17T11:38:15.087 回答