xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
260 stars 132 forks source link

Not possible to obtain a triangulated mesh from IfcConnectionGeometry #287

Open KareshiKraise opened 4 years ago

KareshiKraise commented 4 years ago

I'm trying to obtain a polygonal mesh representing the surfaces between intersecting elements (IfcSpace and other elements in this case)

var relSpaceConnections = parkingRefSpace?.BoundedBy?                        
                        .Select(p => p.ConnectionGeometry);

 foreach (var surface in relSpaceConnections)
 {
      if (surface is IfcConnectionSurfaceGeometry csg)
      {
          var relatingSurface = csg.SurfaceOnRelatingElement;
          if (relatingSurface is IfcCurveBoundedPlane plane)
          {
               var boundary = plane.OuterBoundary;
               //from here on, try to obtain the 3D mesh of the boundary from the geometry reader but it doesnt work
          }
     }
 }

Im not sure this is the correct way of proceeding but I couldnt find any related issue, any help is appreciated

martin1cerny commented 4 years ago

When you say it is not possible, I'm not quite sure what you mean. If it is in the data, xbim will allow you to access it. If it is not in the data, then we wouldn't just make it up. You may want to use debugger to inspect if there is any connection geometry and, if there is any, what type of representation it uses. It might be IfcConnectionCurveGeometry, IfcConnectionPointGeometry, IfcConnectionSurfaceGeometry, IfcConnectionVolumeGeometry but you are only trying to process the surface type.

KareshiKraise commented 4 years ago

Hello Martin, thank you for helping. I am interested in extracting the triangulated 3d mesh representing the contact surface that defines an existing boundary. The inspector shows me that there exists indeed an IfcConnectionGeometry and it is an IfcConnectionSurfaceGeometry, despite both of them being IPersistEntities the geomreader still fails to return a WpfMeshGeometry3D

CBenghi commented 4 years ago

Hello @KareshiKraise,

when we produce the cache of the geometry for a model, we only retain the meshes at IfcProduct level. Intermediate geometry cache is not stored to make the files smaller.

If you are interested in those you'll have to either change the caching routine to retain them, or compute the geometries on demand using the calls available in the geometry engine.

The test project in geometry contains examples of how to do that.

KareshiKraise commented 4 years ago

Hello @CBenghi ,

Thank you for answering my question, now I know how to proceed. Btw, Is this the test project you refer to ? https://github.com/xBimTeam/XbimGeometry -> Xbim.Geometry.Engine.Interop.Tests