public void ReadIfcHeaderTest() { var modelStore = new HeuristicModelProvider(); var schemaVersion = modelStore.GetXbimSchemaVersion("TestFiles\\SampleHouse4.ifc"); Assert.IsTrue(schemaVersion == XbimSchemaVersion.Ifc4); schemaVersion = modelStore.GetXbimSchemaVersion("TestFiles\\4walls1floorSite.ifc"); Assert.IsTrue(schemaVersion == XbimSchemaVersion.Ifc2X3); //first run with a memory model opeing Ifc4 file long count; var credentials = new XbimEditorCredentials { ApplicationIdentifier = "XbimTest1", ApplicationDevelopersName = "Tester", EditorsOrganisationName = "XbimTeam" }; using (var store = IfcStore.Open("TestFiles\\SampleHouse4.ifc")) { count = store.Instances.Count; Assert.IsTrue(count > 0, "Should have more than zero instances"); store.Close(); } //create esent files and check them , a size of 1MB will cause Esent to be used using (var store = IfcStore.Open("TestFiles\\SampleHouse4.ifc", credentials, 1.0)) { Assert.IsTrue(count == store.Instances.Count, "Should have the same number of instances as the memory model"); store.Close(); } //now repeat for Ifc2x3 using (var store = IfcStore.Open("TestFiles\\4walls1floorSite.ifc")) { count = store.Instances.Count; Assert.IsTrue(count > 0, "Should have more than zero instances"); store.Close(); } //create xbim files and check them , a size of 1MB will cause Esent to be used using (var store = IfcStore.Open("TestFiles\\4walls1floorSite.ifc", null, 0.1)) { Assert.IsTrue(count == store.Instances.Count, "Should have the same number of instances as the memory model"); store.Close(); } }
public void IfcStoreCreateStoreTest() { var credentials = new XbimEditorCredentials { ApplicationIdentifier = "XbimTest1", ApplicationDevelopersName = "Tester", EditorsOrganisationName = "XbimTeam" }; using (var store = IfcStore.Create(credentials, XbimSchemaVersion.Ifc2X3, XbimStoreType.EsentDatabase)) { using (var txn = store.BeginTransaction()) { var door = store.Instances.New <IfcDoor>(); door.Name = "Door 1"; txn.Commit(); } store.SaveAs("esent2x3.ifc"); store.Close(); } using (var store = IfcStore.Create(credentials, XbimSchemaVersion.Ifc4, XbimStoreType.EsentDatabase)) { using (var txn = store.BeginTransaction()) { var door = store.Instances.New <Ifc4.SharedBldgElements.IfcDoor>(); door.Name = "Door 1"; txn.Commit(); } store.SaveAs("esent4.ifc"); store.Close(); } using (var store = IfcStore.Create(credentials, XbimSchemaVersion.Ifc2X3, XbimStoreType.InMemoryModel)) { using (var txn = store.BeginTransaction()) { var door = store.Instances.New <IfcDoor>(); door.Name = "Door 1"; txn.Commit(); } store.SaveAs("Memory2X3.ifc"); store.Close(); } using (var store = IfcStore.Create(credentials, XbimSchemaVersion.Ifc4, XbimStoreType.InMemoryModel)) { using (var txn = store.BeginTransaction()) { var door = store.Instances.New <Ifc4.SharedBldgElements.IfcDoor>(); door.Name = "Door 1"; txn.Commit(); } store.SaveAs("Memory4.ifc"); store.Close(); } var modelStore = new HeuristicModelProvider(); var schemaVersion = modelStore.GetXbimSchemaVersion("Esent2X3.ifc"); Assert.IsTrue(schemaVersion == XbimSchemaVersion.Ifc2X3); schemaVersion = modelStore.GetXbimSchemaVersion("Esent4.ifc"); Assert.IsTrue(schemaVersion == XbimSchemaVersion.Ifc4); schemaVersion = modelStore.GetXbimSchemaVersion("Memory2X3.ifc"); Assert.IsTrue(schemaVersion == XbimSchemaVersion.Ifc2X3); schemaVersion = modelStore.GetXbimSchemaVersion("Memory4.ifc"); Assert.IsTrue(schemaVersion == XbimSchemaVersion.Ifc4); }