0

My requirement is to read an existing IFC file with GeometryGym and add a new object to it. So I've written a C# code as follow,

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

This is working well with IFC4 release. But not working for IFC2x3 release. What could be the issue ?

Shamique
  • 86
  • 8

1 Answers1

0

IFC2X3 has no IfcTriangulatedFaceSet. This has been added with IFC4.

You can emulate triangulated surfaces with IfcShellBasedSurfaceModel under IFC2X3.

Loebl
  • 1,381
  • 11
  • 21