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 131 forks source link

Can't get an openingelement to dispaly in the drawingcontrol #442

Open mvb-SNS opened 1 year ago

mvb-SNS commented 1 year ago

I want to display a ifcopeningelement as solid in the drawingcontrol but i can't get it to display correctly. other objects like ifcwallstanardcases have no issues.

                    Xbim3DModelContext context = new Xbim3DModelContext(model);
                    var openingelent = model.Instances.OfType<IfcOpeningElement>().FirstOrDefault(opening => opening.GlobalId == ifcBuildingElement.FirstOrDefault().Openings.FirstOrDefault().GlobalId);
                    context.CreateContext();
                    var geom = model.GeometryStore.BeginRead();
                    var instances = geom.ShapeInstancesOfEntity(openingelent.EntityLabel);
                    var geometries = instances.Select(i => geom.ShapeGeometryOfInstance(i) as IXbimShapeGeometryData);

                    foreach (var g in geometries)
                    {
                        using (var ms = new MemoryStream(g.ShapeData))
                        using (var br = new BinaryReader(ms))
                        {
                            var triangulation = br.ReadShapeTriangulation();
                        }
                    }
                    try
                    {
                        DrawingControl.Model = model;
                        DrawingControl.LoadGeometry(model);
                        DrawingControl.SetCamera(cam);
                        DrawingControl.ShowGridLines = true;
                    }
martin1cerny commented 1 year ago

By default, openings are not rendered in the view. Most of the users don't want to see them as independent elements. But I get your point, there are clear use cases where you may want to see them. You will see, that we don't render IfcSpaces by default either, as they often obscure actual building elements. But there is a styling view, where you can see the spaces, You should be able to do the same for the openings.

mvb-SNS commented 1 year ago

thank your for your reply but I have already implemented a fix I extracted the points i needed from Shapedata and created my own wireframe to display. this is my first time coding with 3d objects so all the help is much appreciated.