예제 #1
0
        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);
            }
        }
예제 #2
0
        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());
                }
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        public void ConvertDPoWToCOBieLite()
        {
            var dpow      = PlanOfWork.Open("NewtownHighSchool.dpow");
            var facility  = new FacilityType();
            var exchanger = new DPoWToCOBieLiteExchanger(dpow, facility);

            exchanger.Convert();
        }
예제 #5
0
        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());
                    }
                }
            }
        }
예제 #6
0
        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());
                    }
                }
            }
        }