Git Product home page Git Product logo

Comments (7)

CBenghi avatar CBenghi commented on June 2, 2024

Hi Michael,
thanks for the question.
This sounds like a serious issue. But I've not understood the problem 100% which we need to reproduce.
Would you be able to produce a test case in Xbim.Essentials.Test?
If you do I'd add it to the solution for debugging (possibly via a pull request?)
You can add small files too, if needed, but ideally we'd like the code to be minimal to identify the offending API.
Thanks,
Claudio

from xbimessentials.

MichaelBuehler avatar MichaelBuehler commented on June 2, 2024

Unit test class Ifc2x3InsertCopyTest.cs to develop stream project Tests added. Note that I had include a 800KB ifc file generated from Autodesk Inventor - if the file is smaller (20KB) it works!

from xbimessentials.

MichaelBuehler avatar MichaelBuehler commented on June 2, 2024

I will upload once I figured out how.. 403 (Forbidden)..

from xbimessentials.

martin1cerny avatar martin1cerny commented on June 2, 2024

You can try pull request.

from xbimessentials.

MichaelBuehler avatar MichaelBuehler commented on June 2, 2024

Files uploaded to (https://github.com/xBimTeam/XbimEssentials/files/551164/Ifc2x3InsertCopyTest.zip)

from xbimessentials.

CBenghi avatar CBenghi commented on June 2, 2024

Thanks, I'll put the files in the solution soon.

from xbimessentials.

martin1cerny avatar martin1cerny commented on June 2, 2024

No need @CBenghi. I found a bug and it is solved now. Thank you @MichaelBuehler very much. This was a very good one to spot out. The problem was actually not related to the InsertCopy() itself but to the way transactions work in EsentModel. It keeps track of modified entities and writes them to database at the end of transaction. But once this is done we were failing to add it there again. This in your code was combined with the fact that size of transaction is limited in Esent engine so with large InsertCopy it needs to flush the changes in the meantime with the same effect. The simple testing code is this:

[TestMethod]
public void EsentMultiTransactionTest()
{
    const string file = "test.ifc";
    using (var model = EsentModel.CreateTemporaryModel(new EntityFactory()))
    {
        IfcCurtainWall wall;
        using (var txn = model.BeginTransaction("New wall"))
        {
            wall = model.Instances.New<IfcCurtainWall>(w => w.Name = "Name");
            txn.Commit();
        }
        using (var txn = model.BeginTransaction("Edit wall"))
        {
            wall.Description = "Description";
            txn.Commit();
        }
        model.SaveAs(file);
    }

    using (var model = EsentModel.CreateTemporaryModel(new EntityFactory()))
    {
        model.CreateFrom(file, null, null, true, true);
        var wall = model.Instances.FirstOrDefault<IfcCurtainWall>();
        Assert.IsTrue(wall.Name == "Name");
        Assert.IsTrue(wall.Description == "Description");
    }
}

from xbimessentials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.