簡體   English   中英

Geometry Gym C#-如何使用新組件修改現有的IFC文件?

[英]Geometry Gym C# - How to modify existing IFC file with new component?

我的要求是使用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版本 可能是什么問題 ?

IFC2X3沒有IfcTriangulatedFaceSet。 這已在IFC4中添加。

您可以在IFC2X3下使用IfcShellBasedSurfaceModel模擬三角化的曲面。

暫無
暫無

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

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