Open ChernyshevDS opened 1 year ago
Thanks for this detailed investigation! Any chance you can submit as a PR rather than a patch? Ideally you'll add a quick test using your stripped model (that'll help ensure we keep this fixed as we merge with the incoming v6 changes.)
@andyward Done: https://github.com/xBimTeam/XbimGeometry/pull/449
Hello again. I've encountered a problem with incorrect mesh generation when trying to load a specific IFC4 model (stripped file is attached below). Some of the elements seem to have distorted geometry:
I beleive that I've managed to find the source of the issue. When loading the model I've received a number of the same warnings like:
This warning is generated in
XbimCompound::InitAdvancedFaces(IEnumerable<IIfcFace^>^ faces, ILogger^ logger)
, specifically for the entityIfcEdgeCurve
#189964. It has underlyingEdgeGeometry
ofIfcTrimmedCurve
#189961 which trims anIfcEllipse
#189960 with trimming defined with cartesian points.The end trimming point clearly lies on the ellipse, but
XbimCurve::LocatePointOnCurve
returnsfalse
. I beleive it is caused by incorrectGeom_Curve
construction invoid XbimCurve::Init(IIfcTrimmedCurve^ curve, ILogger^ logger)
.OpenCascade has a limitation for ellipse shape: unlike IfcEllipse, it should always have a major radius greater than minor radius. To overcome this limitation there is an additional rotation by
Pi/2
applied to ellipse inXbimCurve::Init(IIfcEllipse^, ILogger^)
in case whenSemiAxis1 < SemiAxis2
. This rotation of course has to be taken into account when adjusting trimming parameters.There is a piece of code in
XbimCurve::Init(IIfcTrimmedCurve^ curve, ILogger^ logger)
that does exactly that:However, it should not be applied to parameters
u1
andu2
if they were previously calculated from cartesian points withGeomLib_Tool::Parameter
, because they are already calculated from ellipse rotated byPi/2
.I've made some corrections and created a patch: fix_trimmed_ellipse.patch
Corrected model:
Assemblies and versions affected:
XbimGeometry 5.1.403, commit https://github.com/xBimTeam/XbimGeometry/commit/24a3db9442b33578eebf9fbf2eb58074cc3afc56
Minimal file to reproduce the issue:
IFC VK L4.ifc.stripped.ifc.txt