Geometry Gym C# - Как изменить существующий файл IFC с помощью нового компонента?

Мое требование состоит в том, чтобы прочитать существующий файл IFC с помощью GeometryGym и добавить в него новый объект. Итак, я написал код С# следующим образом:

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. В чем может быть проблема ?


person Shamique    schedule 02.11.2017    source источник


Ответы (1)


IFC2X3 не имеет IfcTriangulatedFaceSet. Это было добавлено с IFC4.

Вы можете эмулировать триангулированные поверхности с помощью IfcShellBasedSurfaceModel в IFC2X3.

person Loebl    schedule 17.05.2018