You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Failed to project vertex to edge geometry, start point assumed
This warning is generated in XbimCompound::InitAdvancedFaces(IEnumerable<IIfcFace^>^ faces, ILogger^ logger), specifically for the entity IfcEdgeCurve #189964. It has underlying EdgeGeometry of IfcTrimmedCurve #189961 which trims an IfcEllipse #189960 with trimming defined with cartesian points.
The end trimming point clearly lies on the ellipse, but XbimCurve::LocatePointOnCurve returns false. I beleive it is caused by incorrect Geom_Curve construction in void 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 in XbimCurve::Init(IIfcEllipse^, ILogger^) in case when SemiAxis1 < 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:
if (isEllipse)
{
IIfcEllipse^ ellipse = (IIfcEllipse^)curve->BasisCurve;
if (ellipse->SemiAxis1 < ellipse->SemiAxis2)
{
u1 -= Math::PI / 2;
u2 -= Math::PI / 2;
}
}
However, it should not be applied to parameters u1 and u2 if they were previously calculated from cartesian points with GeomLib_Tool::Parameter, because they are already calculated from ellipse rotated by Pi/2.
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.)
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 24a3db9
Minimal file to reproduce the issue:
IFC VK L4.ifc.stripped.ifc.txt
The text was updated successfully, but these errors were encountered: