Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while creating IfcSurfaceCurveSweptAreaSolid #446

Open
ChernyshevDS opened this issue Sep 13, 2023 · 1 comment
Open

Error while creating IfcSurfaceCurveSweptAreaSolid #446

ChernyshevDS opened this issue Sep 13, 2023 · 1 comment

Comments

@ChernyshevDS
Copy link

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.

Assemblies and versions affected:

XbimGeometry 5.1.403, commit 24a3db9

Minimal file to reproduce the issue:

IFC OV L4.ifc.stripped.ifc.txt

@ChernyshevDS
Copy link
Author

Upd: may be related to #330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant