public void ConvertDPoWToAll() { var pow = PlanOfWork.OpenJson("001-Lakeside_Restaurant.dpow"); const string dir = "..\\..\\COBieLiteUK"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string msg; foreach (var stage in pow.ProjectStages) { var json = Path.Combine(dir, stage.Name + ".cobie.json"); var xlsx = Path.Combine(dir, stage.Name + ".xlsx"); var ifc = Path.Combine(dir, stage.Name + ".ifc"); var facility = new Xbim.CobieLiteUk.Facility(); var cobieExchanger = new DPoWToCOBieLiteUKExchanger(pow, facility, stage); cobieExchanger.Convert(DateTime.Now); facility.WriteJson(json, true); facility.WriteCobie(xlsx, out msg); //using (var ifcModel = XbimModel.CreateTemporaryModel()) //{ // ifcModel.Initialise("Xbim Tester", "XbimTeam", "Xbim.Exchanger", "Xbim Development Team", "3.0"); // using (var txn = ifcModel.BeginTransaction("Conversion from COBie")) // { // ifcModel.Header.FileName.Name = stage.Name; // ifcModel.ReloadModelFactors(); // var ifcExchanger = new XbimExchanger.COBieLiteUkToIfc.CoBieLiteUkToIfcExchanger(facility, ifcModel); // ifcExchanger.Convert(); // txn.Commit(); // } // ifcModel.SaveAs(ifc, XbimStorageType.IFC); // ifcModel.Close(); //} } }
public void ConvertDPoWToCOBieLite() { //var pow = PlanOfWork.OpenJson("NewtownHighSchool.new.dpow"); var pow = PlanOfWork.OpenJson("013-Lakeside_Restaurant.dpow"); const string dir = "..\\..\\COBieLiteUK"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var outputs = new List <string>(); string msg; foreach (var stage in pow.ProjectStages) { var facility = new Xbim.CobieLiteUk.Facility(); var exchanger = new DPoWToCOBieLiteUKExchanger(pow, facility, stage); exchanger.Convert(); var output = Path.Combine(dir, stage.Name + ".cobieliteUK.json"); var xls = Path.Combine(dir, stage.Name + ".xlsx"); outputs.Add(output); facility.WriteJson(output, true); facility.WriteCobie(xls, out msg); } //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 = Xbim.CobieLiteUk.Facility.ReadJson(output); } }