I have models that contain polylines with just two points defined, one of which is redundant (duplicate). That redundant point used to be filtered out in 4.x but seems to remain in 5.x, causing issues later. The issue specifically is an AccessViolationException, which can't be caught gracefully causing a hard crash.
Assemblies and versions affected:
Xbim.Geometry 5.1.430
Steps (or code) to reproduce the issue:
Load attached file and generate geometry (eg open it in XbimXplorer 5.x).
It will throw an exception when processing the Directrix for IfcSweptDiskSolid #30092
XbimXplorer 4.x seems to remove redundant points, which cascades into complete removal of the wire, causing the IfcSweptDiskSolid to become an empty shape. It is even nice enough to log those issues as warnings:
Actual behavior or exception details:
Redundant points don't seem to get removed anymore, causing issues in OCC later on.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at BRepAdaptor_CompCurve.{ctor}(BRepAdaptor_CompCurve* , TopoDS_Wire* , Boolean )
at Xbim.Geometry.XbimSolid.CreateDirectrix(IIfcCurve directrix, Nullable`1 startParam, Nullable`1 endParam, ILogger logger)
at Xbim.Geometry.XbimSolid.Init(IIfcSweptDiskSolid solid, ILogger logger)
at Xbim.Geometry.XbimSolid..ctor(IIfcSweptDiskSolid solid, ILogger logger)
at Xbim.Geometry.XbimGeometryCreator.CreateSolid(IIfcSweptDiskSolid ifcSolid, ILogger logger)
at Xbim.Geometry.XbimGeometryCreator.Create(IIfcGeometricRepresentationItem geomRep, IIfcAxis2Placement3D objectLocation, ILogger logger)
at Xbim.Geometry.Engine.Interop.XbimGeometryEngine.Create(IIfcGeometricRepresentationItem ifcRepresentation, ILogger logger) in C:\buildagent_os\_work\1\s\Xbim.Geometry.Engine.Interop\XbimGeometryEngine.cs:line 74
at Xbim.ModelGeometry.Scene.Xbim3DModelContext.<>c__DisplayClass39_0.<WriteShapeGeometries>b__0(Int32 shapeId) in C:\buildagent_os\_work\1\s\Xbim.ModelGeometry.Scene\Xbim3DModelContext.cs:line 1379
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
at System.Threading.Tasks.Task.Execute()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Additional Details
The following image is the piece of code that used to remove redundant points in 4.x:
I can't find similar code in 5.x
I have models that contain polylines with just two points defined, one of which is redundant (duplicate). That redundant point used to be filtered out in 4.x but seems to remain in 5.x, causing issues later. The issue specifically is an AccessViolationException, which can't be caught gracefully causing a hard crash.
Assemblies and versions affected:
Xbim.Geometry 5.1.430
Steps (or code) to reproduce the issue:
Load attached file and generate geometry (eg open it in XbimXplorer 5.x). It will throw an exception when processing the Directrix for IfcSweptDiskSolid #30092
Minimal file to reproduce the issue:
accessviolationexception.zip
Expected behavior:
XbimXplorer 4.x seems to remove redundant points, which cascades into complete removal of the wire, causing the IfcSweptDiskSolid to become an empty shape. It is even nice enough to log those issues as warnings:
Actual behavior or exception details:
Redundant points don't seem to get removed anymore, causing issues in OCC later on.
Additional Details
The following image is the piece of code that used to remove redundant points in 4.x: I can't find similar code in 5.x