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 132 forks source link

On Azure (winx64) deployed it generates gltf with missing geometry #491

Open rubit0 opened 3 months ago

rubit0 commented 3 months ago

I made a asp.net (dotnet 8) web app to convert a ifc file to gltf but when deployed to azure (standard winx64 dotnet appservice plan) it generates a gltf with missing geometry. I tried all sort of combinations, self-contained single file, x64, x86, and the default dotnet 8 runtime.

bim2go_backend_3d-problem

There are no errors and I exhausted all possible deployment configuration options. I'm using the latest stable releases:

<PackageReference Include="Xbim.Essentials" Version="6.0.445" />
<PackageReference Include="Xbim.Geometry" Version="5.1.541" />
<PackageReference Include="Xbim.Gltf.IO" Version="5.1.120" />

This is the main code snipped that generates the gltf:

public static byte[] CreateGltf(Stream ifcFileStream)
{
    using var ifcStore = IfcStore.Open(ifcFileStream,
        Xbim.IO.StorageType.Ifc,
        Xbim.Common.Step21.XbimSchemaVersion.Ifc2X3,
        Xbim.IO.XbimModelType.MemoryModel);

    var context3DModel = new Xbim3DModelContext(ifcStore);
    context3DModel.CreateContext(null, false);
    var sceneBuilder = new Builder();
    var gltf = sceneBuilder.BuildInstancedScene(ifcStore, XbimMatrix3D.Identity, new List<Type>
        {
            typeof(IIfcSpace),
            typeof(IIfcFeatureElement)
        });

    using (var memoryStream = new MemoryStream())
    {
        Interface.SaveModel(gltf, memoryStream);
        return memoryStream.ToArray();
    }
}

I would love to find out how to fix this issue, in theory there should be no difference between my dotnet runtime and the one on azure. Could this be a floating point precision issue?

andyward commented 3 months ago

Very strange. We've used Xbim.Geometry 5.1 & 6 extensively in azure app services (winx86 and winx64) and not seen this kind of 'partial' failure. Azure issues are usually all or nothing (environmental etc) rather than this kind of thing. However we're not using gltf which may add another layer of complexity.

Things to check:

It looks like it's failing to cut the openings (a boolean operation in OpenCascade). That might point at a few things including: