Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Multiple IFC Files #588

Open
ShehabFekry opened this issue Nov 18, 2024 · 0 comments
Open

Merge Multiple IFC Files #588

ShehabFekry opened this issue Nov 18, 2024 · 0 comments

Comments

@ShehabFekry
Copy link

I have multiple IFC files with

Xbim.Essentials 4.0.29

`using (var model1 = IfcStore.Open(@"E:\2218-ATA-TRK-ZZZ-2DM-AR-2218-ATA-B01-ZZZ-MOD-AR.ifc"))
{
// Load the second IFC file
using (var model2 = IfcStore.Open(@"E:\2218-ATA-TRK-ZZZ-2DM-AR-2218-ATA-B02-ZZZ-MOD-AR.ifc"))
{
// Create a new IFC store for the merged model
using (var mergedModel = IfcStore.Create(XbimSchemaVersion.Ifc2X3, Xbim.IO.XbimStoreType.InMemoryModel))
{
using (var transaction = mergedModel.BeginTransaction("Merging IFC Files"))
{
var mappings1 = new XbimInstanceHandleMap(model1, mergedModel);
var mappings2 = new XbimInstanceHandleMap(model2, mergedModel);
var instances = model1.Instances.ToList();
// Copy all entities from the first model
int counter = 0;
foreach (var entity in model1.Instances.ToList())
{
if (entity.EntityLabel >= 22 && entity.EntityLabel <= 28) { continue; }
mergedModel.InsertCopy(entity, mappings1, null, true, false);
counter++;
}

            foreach (var entity in model2.Instances.ToList())
            {
                mergedModel.InsertCopy(entity, mappings2, null, true, false);
            }

            // Commit the transaction
            transaction.Commit();
        }

        // Save the merged model to a new file
        mergedModel.SaveAs(@"E:\merged.ifc");
    }
}

}`

Expected behavior:

What would you expect to happen

I expect all entities from both models to be placed in the new model.

What actually is happening
The entities take in the foreach loop some entities take a very long time to be placed entities like IFCGEOMETRICREPRESNTATIONSUBCONTEXT('Axis') .. etc

in the screen shot entities with label 22 to 26

Screenshot 2024-11-18 161948

why do they take all this time? and what should i do to increase the speed of the plugin to merge multiple ifc files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant