XbimWindowsUI icon indicating copy to clipboard operation
XbimWindowsUI copied to clipboard

Issue with rendering IfcSweptDiskSolid

Open IbrahimMassoud opened this issue 4 years ago • 1 comments

I have a problem with rendering IfcSweptDiskSolid if its curve has more than one plane, although it works well with other viewers like Autodesk Viewer

down here is the sample of code I used.

using (var txn = model.BeginTransaction()) {

                ICollection<IfcCartesianPoint> barVertices = new List<IfcCartesianPoint>();
                barVertices.Add(model.Instances.New<IfcCartesianPoint>(c => c.SetXYZ(1000, 250, 150)));
                barVertices.Add(model.Instances.New<IfcCartesianPoint>(c => c.SetXYZ(1000, 250, -150)));
                barVertices.Add(model.Instances.New<IfcCartesianPoint>(c => c.SetXYZ(1000, -250, -150)));
                barVertices.Add(model.Instances.New<IfcCartesianPoint>(c => c.SetXYZ(1000, -250, 150)));
                barVertices.Add(model.Instances.New<IfcCartesianPoint>(c => c.SetXYZ(1000, 250, 150)));


                model.Instances.New<IfcSweptDiskSolidPolygonal>(sds =>
                {
                    sds.Directrix = model.Instances.New<IfcCompositeCurve>(cc =>
                    {
                        cc.Segments.Add(model.Instances.New<IfcCompositeCurveSegment>(ccs =>
                        {
                            ccs.Transition = IfcTransitionCode.DISCONTINUOUS;
                            ccs.SameSense = true;
                            ccs.ParentCurve = model.Instances.New<IfcPolyline>(pl =>
                            {
                                pl.Points.AddRange(barVertices);
                            });
                        }
                        ));
                        cc.SelfIntersect = false;
                    });
                    sds.Radius = 18;
                });

                txn.Commit();
            }

You can check this image to find the difference between the expected behavior and the actual one. bar

This is the output ifc file: stirrup.zip

IbrahimMassoud avatar Sep 21 '21 12:09 IbrahimMassoud

The provided model does not conform to the standard, because according to the description of the IfcSweptDiskSolidPolygonal the directrix curve may only be IfcPolyline, and in this model we have IfcCompositeCurve containing single IfcPolyLine. However, I think Xbim could allow this. The problem can be fixed in void XbimSolid::Init(IIfcSweptDiskSolid^ repItem, ILogger^ logger) by setting transitionMode to BRepBuilderAPI_TransitionMode::BRepBuilderAPI_RightCorner. The is already some logic to determine the transitionMode value based on directrix curve type, but using IfcCompositeCurve breaks it.

ChernyshevDS avatar Sep 16 '24 10:09 ChernyshevDS