xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
254 stars 128 forks source link

cannot read IFC file because of error on IfcCShapeProfileDef #414

Open okaharu0795 opened 1 year ago

okaharu0795 commented 1 year ago

Hello, team!

thank you for your development. I'm afraid I faced below error, so I report it to you.

what happens

When I opened a IFC file from Rebro (Rebro is a BIM made by NYK Systems) at Xbim Xplorer, I couldn't open it and the log was outputed like below.

ERROR   Xbim.Geometry.XbimGeometryCreator
EE001: Failed to create geometry xBimTeam/XbimEssentials#9 of type IfcExtrudedAreaSolid, オブジェクト参照がオブジェクト インスタンスに設定されていません。

When I used XBIM library to read same IFC file on my code, it happened as well.

the IFC file is here, CShapeChannel_Rebro.zip

cause

The error occurs when values of WallThickness and Girth are same in IfcCShapeProfileDef class. (I attacehd image below)

ifccshapeprofiledef

When values of them are changed to that a value of Girth is bigger than a value of WallThickness, files can be open.

ask

This file can be opend at IFC viewer like BIMVision, so I think IFC file is not wrong.

If it is possible, I would like you to fix this to be able to open and read that file by Xbim.

Thank you.

andyward commented 1 year ago

Thanks for this, have confirmed its an issue on latest v5.1 as well as in our new v6 engine

v5.1 Release

image

v5 Engine:

image

and in v6 Engine: (6.1.0.636)

image

Full exception from V6:

2023-02-03 09:44:47.482 +00:00 [WRN] #9=IfcExtrudedAreaSolid: Geometry Service Error (9)
Xbim.Geometry.Exceptions.XbimGeometryServiceException: Geometry Service Error
 ---> System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at BRepBuilderAPI_MakeEdge..?AVTopoDS_Edge@@(BRepBuilderAPI_MakeEdge* , TopoDS_Edge* )
   at Xbim.Geometry.XbimWire.Init(IIfcCShapeProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 1984
   at Xbim.Geometry.XbimWire.Init(IIfcParameterizedProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 1318
   at Xbim.Geometry.XbimWire.Init(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 1269
   at Xbim.Geometry.XbimWire..ctor(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 149
   at Xbim.Geometry.XbimFace.Init(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimFace.cpp:line 1048
   at Xbim.Geometry.XbimFace..ctor(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimFace.cpp:line 198
   at Xbim.Geometry.XbimSolid.Init(IIfcExtrudedAreaSolid solid, IIfcProfileDef overrideProfileDef, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimSolid.cpp:line 1259
   at Xbim.Geometry.XbimSolid..ctor(IIfcExtrudedAreaSolid solid, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimSolid.cpp:line 178
   at Xbim.Geometry.XbimGeometryCreatorV6.CreateSolid(IIfcExtrudedAreaSolid ifcSolid, ILogger __unnamed001) in D:\a\1\s\Xbim.Geometry.Engine\XbimGeometryCreatorV6.cpp:line 459
   at Xbim.Geometry.XbimGeometryCreatorV6.Create(IIfcGeometricRepresentationItem geomRep, IIfcAxis2Placement3D objectLocation, ILogger __unnamed002) in D:\a\1\s\Xbim.Geometry.Engine\XbimGeometryCreatorV6.cpp:line 94
   --- End of inner exception stack trace ---
2023-02-03 09:44:47.513 +00:00 [ERR] Processing failure (9)
Xbim.Geometry.Exceptions.XbimGeometryServiceException: Geometry Service Error
 ---> System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at BRepBuilderAPI_MakeEdge..?AVTopoDS_Edge@@(BRepBuilderAPI_MakeEdge* , TopoDS_Edge* )
   at Xbim.Geometry.XbimWire.Init(IIfcCShapeProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 1984
   at Xbim.Geometry.XbimWire.Init(IIfcParameterizedProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 1318
   at Xbim.Geometry.XbimWire.Init(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 1269
   at Xbim.Geometry.XbimWire..ctor(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimWire.cpp:line 149
   at Xbim.Geometry.XbimFace.Init(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimFace.cpp:line 1048
   at Xbim.Geometry.XbimFace..ctor(IIfcProfileDef profile, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimFace.cpp:line 198
   at Xbim.Geometry.XbimSolid.Init(IIfcExtrudedAreaSolid solid, IIfcProfileDef overrideProfileDef, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimSolid.cpp:line 1259
   at Xbim.Geometry.XbimSolid..ctor(IIfcExtrudedAreaSolid solid, ILogger logger) in D:\a\1\s\Xbim.Geometry.Engine\XbimSolid.cpp:line 178
   at Xbim.Geometry.XbimGeometryCreatorV6.CreateSolid(IIfcExtrudedAreaSolid ifcSolid, ILogger __unnamed001) in D:\a\1\s\Xbim.Geometry.Engine\XbimGeometryCreatorV6.cpp:line 459
   at Xbim.Geometry.XbimGeometryCreatorV6.Create(IIfcGeometricRepresentationItem geomRep, IIfcAxis2Placement3D objectLocation, ILogger __unnamed002) in D:\a\1\s\Xbim.Geometry.Engine\XbimGeometryCreatorV6.cpp:line 94
   --- End of inner exception stack trace ---
   at Xbim.Geometry.XbimGeometryCreatorV6.Create(IIfcGeometricRepresentationItem geomRep, IIfcAxis2Placement3D objectLocation, ILogger __unnamed002) in D:\a\1\s\Xbim.Geometry.Engine\XbimGeometryCreatorV6.cpp:line 226
   at Xbim.ModelGeometry.Scene.Xbim3DModelContext.<>c__DisplayClass41_0.<WriteShapeGeometries>b__0(Int32 shapeId)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica`1.ExecuteAction(Boolean& yieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()
2023-02-03 09:44:47.584 +00:00 [ERR] Error creating geometry context of C:\Users\AndyWard\Downloads\CShapeChannel_Rebro.ifczip (9)
System.Exception: Error creating geometry context of 'C:\Users\AndyWard\Downloads\CShapeChannel_Rebro.ifczip'    at Xbim.ModelGeometry.Scene.Xbim3DModelContext.WriteShapeGeometries(XbimCreateContextHelper contextHelper, ReportProgressDelegate progDelegate, IGeometryStoreInitialiser geometryStore, XbimGeometryType geomStorageType)
   at Xbim.ModelGeometry.Scene.Xbim3DModelContext.CreateContext(ReportProgressDelegate progDelegate, Boolean adjustWcs)
   at XbimXplorer.XplorerMainWindow.OpenAcceptableExtension(Object s, DoWorkEventArgs args) in C:\Users\AndyWard\Source\Repos\Private\XbimWindowsUI\XbimXplorer\XplorerMainWindow.xaml.cs:line 330.
okaharu0795 commented 1 year ago

Thank you for confirming and shareing! I'm looking forword to it being fixed :)

okaharu0795 commented 1 year ago

@andyward @SteveLockley hi!

I have already fixed this bug and I'm trying to test with local nuget package. I found following error when I installed it. Would you tell me what I should fix?

Attempting to gather dependency information for package 'Xbim.Geometry.6.1.0.2-dev' with respect to project 'IFCExporter', targeting '.NETFramework,Version=v4.7.2'
Gathering dependency information took 30.66 sec
Attempting to resolve dependencies for package 'Xbim.Geometry.6.1.0.2-dev' with DependencyBehavior 'Lowest'
Unable to resolve dependencies. 'Xbim.Geometry.Abstractions 6.1.302-alpha' is not compatible with 'Xbim.Geometry.Engine.Interop 5.7.2-V9Experimental constraint: Xbim.Geometry.Abstractions (>= 6.2.280)'.
Time Elapsed: 00:00:31.1009846
========== Finished ==========
andyward commented 1 year ago

Glad to hear you're looking to help & fix

Are you able to share your fork? which branch is it based off? develop would be best and I'd avoid the netcore branch as it's pre-release, & you may not have access to the dependencies.

It looks like you're picking up a netcore version of Geometry (which has 6.1+ version numbers). If you're building off develop you should have 5.1.x version of Xbim.GeometryEngine (and no dependence on Xbim.Geometry.Abstractions

okaharu0795 commented 1 year ago

@andyward thank you for quick reply! As you say, my branch is based off netcore. So I'll create one from develop and build it.

okaharu0795 commented 1 year ago

@andyward hi!

I've tried to install the nuget that include my fix to my app for test. I am having trouble figuring out what to do.

in Xbim.Geometry

  1. create my branch based off develop
  2. fix a bug in Xbim.Geometry.Engine
  3. build as Release -> cleate following files
    • Xbim.Geometry.tmpl in Xbim.Geometry folder
    • Xbim.Geometry.Engine.Interop.5.1.0.nupkg in Xbim.Geometry.Engine.Interop\bin\Release folder
    • Xbim.ModelGeometry.Scene.5.1.0-Dev.nupkg inXbim.ModelGeometry.Scene\bin\Release folder

in my app

  1. uninstall these nugets: Xbim.Geometry, Xbim.Geometry.Engine.Interop and Xbim.ModelGeometry.Scene
    • I needed to uninstall Xbim.Geometry and Xbim.ModelGeometry.Scene, because Xbim.Geometry.Engine.Interop is dependent on it.
  2. register nupkgs(Xbim.Geometry.Engine.Interop and Xbim.ModelGeometry.Scene) to package soures

I could install Xbim.Geometry.Engine.Interop and Xbim.ModelGeometry.Scene as 5.1.0 version. But I have no idea to install Xbim.Geometry. (Actually I've gotten only tmpl file..)

Can you help me?

andyward commented 1 year ago

I could install Xbim.Geometry.Engine.Interop and Xbim.ModelGeometry.Scene as 5.1.0 version. But I have no idea to install Xbim.Geometry. (Actually I've gotten only tmpl file..)

The build server takes care of that (it generates the nuspec in the build from the template)

But really Xbim.Geometry is just an empty package that depends on Interop and Scene. It's for backward compatibility and convenience., so you can test by just adding Interop and Scene explicitly in place of Xbim.Geometry. What you can do is create a local folder for nuget packages and put those 2 nupkgs in.

When you create a PR it should all shake out

okaharu0795 commented 1 year ago

@andyward thank you for your reply. I tried to test, but I couldn't conduct because of another error. So I created PR. Could you check this and please tell me if there are something I should do?

okaharu0795 commented 1 year ago

@andyward Thank you for marging! Do you know the date of next release that will include this fix? If the date has not been decided or far away, I would like you to tell me how to create nuget at local and use it in my application. thank you!

andyward commented 1 year ago

Rather than cherry pick to master (which pushes to Nuget) I suggest we pick this up in the next release - V6 (soon!)

If you want to access a nuget immediately you can use our Myget Feed. Simply add a nuget.config to the root of your solution adding https://www.myget.org/F/xbim-develop/api/v3/index.json (you may need to restart VS).

See here for a sample nuget.config

CCT-Mukund-Thakare commented 1 year ago

@andyward Hello, I also encountered the same problem, Do you guys have any tentative date for the latest release including this fix ?

Thank you !!

CCT-Mukund-Thakare commented 1 year ago

@andyward @SteveLockley Hello Andy, Since wanted to access a Nuget immediately for this particular PR, So I followed your instructions to get the package from Myget feed.

Now the problem is, whenever I use the latest package in my application, it does not exit successfully. I do get the desired output without any exception. but the exit code of the application is not 0, previously( old xbim packages) it was used to be 0.

How do we check exit code/error code/ errorlevel ? image

The return code of the application is not 0 (0 meaning successfully exited).

Let me know if you have any thoughts on How to fix this ? Adding change log to understand previous version's of package that we were using and new version of package that we are using. image

Thank you !!

andyward commented 1 year ago

@CCT-Mukund-Thakare Not sure of the relevance to this issue? Can you raise separately? You'll have to show us your IfcExporter Project (ideally a repo)

CCT-Mukund-Thakare commented 1 year ago

@andyward @SteveLockley Hello Andy, Thank you for your reply.

Yeah I agree, possibly this exit code issue is not related with this particular issue. I have raised the different issue for the same.

Unfortunately, I will not be able to share the repository with you, but possibly I will be able to share the project configuration's if needed.

Thank you !!