public void ConvertDPoWToCOBieLite() { var pow = PlanOfWork.OpenJson("NewtownHighSchool.new.dpow"); const string dir = "Export"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var outputs = new List <string>(); foreach (var stage in pow.ProjectStages) { var facility = new FacilityType(); var exchanger = new DPoWToCOBieLiteExchanger(pow, facility, stage); exchanger.Convert(); var output = Path.Combine(dir, stage.Name + ".json"); outputs.Add(output); facility.WriteJson(output); } //check all result files exist foreach (var output in outputs) { Assert.IsTrue(File.Exists(output)); } //try to reload to make sure serialization and deserilization works in both directions foreach (var output in outputs) { var facility = FacilityType.ReadJson(output); } }
public void Dpow2CobieLite2Ifc() { var pow = PlanOfWork.OpenJson("NewtownHighSchool.new.dpow"); const string dir = "..\\..\\Export"; if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); foreach (var stage in pow.ProjectStages) { var facility = new FacilityType(); var d2C = new DPoWToCOBieLiteExchanger(pow, facility, stage); d2C.Convert(); var outputIfc = Path.Combine(dir, stage.Name + ".DPoW.ifc"); var outputCobieJson = Path.Combine(dir, stage.Name + ".DPoW.json"); var outputCobieXml = Path.Combine(dir, stage.Name + ".DPoW.xml"); facility.WriteJson(outputCobieJson); facility.WriteXml(outputCobieXml); using (var model = XbimModel.CreateTemporaryModel()) { model.Initialise("Xbim Tester", "XbimTeam", "Xbim.Exchanger", "Xbim Development Team", "3.0"); model.ReloadModelFactors(); using (var txn = model.BeginTransaction("Convert from COBieLite")) { var c2Ifc = new CoBieLiteToIfcExchanger(facility, model); c2Ifc.Convert(); txn.Commit(); } model.SaveAs(outputIfc, XbimStorageType.IFC); if (facility.AssetTypes != null) Assert.AreEqual(facility.AssetTypes.Count(), model.Instances.OfType<IfcTypeObject>().Count()); } } }
public void ConvertDPoWToCOBieLite() { var pow = PlanOfWork.OpenJson("NewtownHighSchool.new.dpow"); const string dir = "Export"; if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); var outputs = new List<string>(); foreach (var stage in pow.ProjectStages) { var facility = new FacilityType(); var exchanger = new DPoWToCOBieLiteExchanger(pow, facility, stage); exchanger.Convert(); var output = Path.Combine(dir, stage.Name + ".json"); outputs.Add(output); facility.WriteJson(output); } //check all result files exist foreach (var output in outputs) { Assert.IsTrue(File.Exists(output)); } //try to reload to make sure serialization and deserilization works in both directions foreach (var output in outputs) { var facility = FacilityType.ReadJson(output); } }
public void ConvertDPoWToCOBieLite() { var dpow = PlanOfWork.Open("NewtownHighSchool.dpow"); var facility = new FacilityType(); var exchanger = new DPoWToCOBieLiteExchanger(dpow, facility); exchanger.Convert(); }
public void Dpow2CobieLite2Ifc() { var pow = PlanOfWork.OpenJson("NewtownHighSchool.new.dpow"); const string dir = "..\\..\\Export"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } foreach (var stage in pow.ProjectStages) { var facility = new FacilityType(); var d2C = new DPoWToCOBieLiteExchanger(pow, facility, stage); d2C.Convert(); var outputIfc = Path.Combine(dir, stage.Name + ".DPoW.ifc"); var outputCobieJson = Path.Combine(dir, stage.Name + ".DPoW.json"); var outputCobieXml = Path.Combine(dir, stage.Name + ".DPoW.xml"); facility.WriteJson(outputCobieJson); facility.WriteXml(outputCobieXml); var credentials = new XbimEditorCredentials() { ApplicationDevelopersName = "XbimTeam", ApplicationFullName = "Xbim.Exchanger", EditorsOrganisationName = "Xbim Development Team", EditorsFamilyName = "Xbim Tester", ApplicationVersion = "3.0" }; using (var model = IfcStore.Create(credentials, IfcSchemaVersion.Ifc2X3, XbimStoreType.InMemoryModel)) { using (var txn = model.BeginTransaction("Convert from COBieLite")) { var c2Ifc = new CoBieLiteToIfcExchanger(facility, model); c2Ifc.Convert(); txn.Commit(); } model.SaveAs(outputIfc, IfcStorageType.Ifc); if (facility.AssetTypes != null) { Assert.AreEqual(facility.AssetTypes.Count(), model.Instances.OfType <IfcTypeObject>().Count()); } } } }
public void Dpow2CobieLite2Ifc() { var pow = PlanOfWork.OpenJson("NewtownHighSchool.new.dpow"); const string dir = "..\\..\\Export"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } foreach (var stage in pow.ProjectStages) { var facility = new FacilityType(); var d2C = new DPoWToCOBieLiteExchanger(pow, facility, stage); d2C.Convert(); var outputIfc = Path.Combine(dir, stage.Name + ".DPoW.ifc"); var outputCobieJson = Path.Combine(dir, stage.Name + ".DPoW.json"); var outputCobieXml = Path.Combine(dir, stage.Name + ".DPoW.xml"); facility.WriteJson(outputCobieJson); facility.WriteXml(outputCobieXml); using (var model = XbimModel.CreateTemporaryModel()) { model.Initialise("Xbim Tester", "XbimTeam", "Xbim.Exchanger", "Xbim Development Team", "3.0"); model.ReloadModelFactors(); using (var txn = model.BeginTransaction("Convert from COBieLite")) { var c2Ifc = new CoBieLiteToIfcExchanger(facility, model); c2Ifc.Convert(); txn.Commit(); } model.SaveAs(outputIfc, XbimStorageType.IFC); if (facility.AssetTypes != null) { Assert.AreEqual(facility.AssetTypes.Count(), model.Instances.OfType <IfcTypeObject>().Count()); } } } }