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
260 stars 131 forks source link

v6: Can't use Xbim3DModelContext without registering services with services.AddXbimGeometryEngine() #440

Open andyward opened 1 year ago

andyward commented 1 year ago

Under v6 GE, invoking

var context = new Xbim3DModelContext(model);

Throws InvalidOperationException: An implementation of IXbimGeometryServicesFactory could not be foundEnsure you have registered the GeometryEngine with services.AddXbimGeometryEngine()

The workaround is to add the following at application startup

Xbim.Common.Configuration.XbimServices.Current.ConfigureServices(s => s.AddXbimGeometryServices());

We should look to streamline this so ModelScene does this for developers. The common challenge is that the Services Container may have been constructed before any initialisation code can be invoked. Alternatively, make the error much more explicit about the corrective action.