Hello. I've encountered a problem during opening one of my models: creating Xbim3DModelContext causes the following exception:
System.Exception: General Error Creating IfcSurfaceCurveSweptAreaSolid, #333640
в Xbim.Geometry.XbimGeometryCreator.Create(IIfcGeometricRepresentationItem geomRep, IIfcAxis2Placement3D objectLocation, ILogger logger) в D:\Projects\Repos\XbimGeometry\Xbim.Geometry.Engine\XbimGeometryCreator.cpp:строка 306
в Xbim.Geometry.Engine.Interop.XbimGeometryEngine.Create(IIfcGeometricRepresentationItem ifcRepresentation, ILogger logger) в C:\buildagent_os\_work\1\s\Xbim.Geometry.Engine.Interop\XbimGeometryEngine.cs:строка 74
в Xbim.ModelGeometry.Scene.Xbim3DModelContext.<>c__DisplayClass39_0.<WriteShapeGeometries>b__0(Int32 shapeId) в D:\Projects\Repos\XbimGeometry\Xbim.ModelGeometry.Scene\Xbim3DModelContext.cs:строка 1379
в System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1()
в System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
в System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
The exception is raised in the following method: void XbimFace::Init(IIfcSurfaceOfLinearExtrusion^ sLin, bool /*useWorkArounds*/, ILogger^ logger). It has a block of code applying a workaround named #RevitIncorrectArcCentreSweptCurve:
IIfcTrimmedCurve^ tc = ...
...
//the centre has been transformed twice, recalculate the centre
//trim 1 and trim 2 will be cartesian points
IIfcCartesianPoint^ trim1 = dynamic_cast<IIfcCartesianPoint^>(Enumerable::FirstOrDefault(tc->Trim1));
IIfcCartesianPoint^ trim2 = dynamic_cast<IIfcCartesianPoint^>(Enumerable::FirstOrDefault(tc->Trim2));
gp_Pnt p1 = XbimConvert::GetPoint3d(trim1);
gp_Pnt p2 = XbimConvert::GetPoint3d(trim2);
...
The comment indicates that IIfcCartesianPoints are expected, but IfcTrimmedCurve may be defined not only with cartesian points, but with IfcParameterValues too. That is exactly the case in my model - dynamic_cast<IIfcCartesianPoint^> returns nullptr. The simplest fix is just to add a null check on trim1 and trim2, but then the workaround would be skipped and I'm not sure if it should be applied differently in this case.
Hello. I've encountered a problem during opening one of my models: creating
Xbim3DModelContext
causes the following exception:The exception is raised in the following method:
void XbimFace::Init(IIfcSurfaceOfLinearExtrusion^ sLin, bool /*useWorkArounds*/, ILogger^ logger)
. It has a block of code applying a workaround named#RevitIncorrectArcCentreSweptCurve
:The comment indicates that
IIfcCartesianPoint
s are expected, but IfcTrimmedCurve may be defined not only with cartesian points, but withIfcParameterValue
s too. That is exactly the case in my model -dynamic_cast<IIfcCartesianPoint^>
returnsnullptr
. The simplest fix is just to add a null check ontrim1
andtrim2
, but then the workaround would be skipped and I'm not sure if it should be applied differently in this case.Assemblies and versions affected:
XbimGeometry 5.1.403, commit https://github.com/xBimTeam/XbimGeometry/commit/24a3db9442b33578eebf9fbf2eb58074cc3afc56
Minimal file to reproduce the issue:
IFC OV L4.ifc.stripped.ifc.txt