xBimTeam / XbimExchange

XbimExchange contains several COBie schemas and serialisation functions as well as the Model Validation library adopted by theNBS digital toolkit.
https://xbimteam.github.io/
Other
46 stars 42 forks source link

Error in converting Ifc to wexbim file #47

Closed Princepra closed 4 years ago

Princepra commented 4 years ago

while running the following code, got the error :

Exception thrown: 'System.IO.FileLoadException' in Xbim.Geometry.Engine.Interop.dll The program '[20300] 12test.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

Here is my code:

using System; using System.IO; using Xbim.Ifc; using Xbim.ModelGeometry.Scene; using Xbim.Geometry.Engine.Interop;

namespace _12test { class Program { public static void Main(string[] args) { var fileName = "Ar.ifc"; using (var model = IfcStore.Open(fileName)) { var context = new Xbim3DModelContext(model); context.CreateContext();

            var wexBimFilename = Path.ChangeExtension(fileName, "wexBIM");
            using (var wexBiMfile = File.Create(wexBimFilename))
            {
                using (var wexBimBinaryWriter = new BinaryWriter(wexBiMfile))
                {
                    model.SaveAsWexBim(wexBimBinaryWriter);
                    wexBimBinaryWriter.Close();
                }
                wexBiMfile.Close();
            }  
        }

        Console.WriteLine();   
    }
}

}

andyward commented 4 years ago

Duplicate of https://github.com/xBimTeam/XbimGeometry/issues/219

This isn't an Exchange issue.