xBimTeam / XbimExchange

XbimExchange contains several COBie schemas and serialisation functions as well as the Model Validation library adopted by theNBS digital toolkit.
https://xbimteam.github.io/
Other
46 stars 42 forks source link

Missing properties while converting IFC to JSON #57

Open castronelson opened 3 years ago

castronelson commented 3 years ago

Hi, Hope you are doing well!!! We have converted IFC file to JSON and WEXBIM format while uploading the IFC file in our web application. After JSON conversion - some 'IFCCOVERING' type of properties are missing in JSON file. I have herewith attached the screenshot for your reference. Kindly provide a sample c# code to convert IFC to JSON file (with exporting all properties without missing anything).

IFCCOVERING

Thank you in advance.

martin1cerny commented 3 years ago

I assume you are using XbimExchange to convert IFC to JSON file. Conversion is configurable and you can see the complete conversion in the source. So, I'd recomend to have a look at it. If you want to use this as part of any web application, you might want to think about something else than one big JSON file as it is not scalable.

At xbim ltd. we have a commercial cloud service where you could offload geometry processing (from IFC to wexbim) and get a scalable access to IFC data (JSON REST services). Let me know if you were interested.

castronelson commented 3 years ago

Hi, we are not able to get complete Json file, Some IFC properties are missing. Below is the code we are using in our application to convert JSON.

using (var m = IfcStore.Open(IfcTestFile))
            {
                var xbimTestFile = Path.ChangeExtension(IfcTestFile, "xbim");
                var jsonFile = Path.ChangeExtension(IfcTestFile, "json");
                var helper = new COBieLite.CoBieLiteHelper(m, "UniClass");
                var facilities = helper.GetFacilities();
                var NewJsonFile = jsonFile;
                foreach (var facilityType in facilities)
                {
                    Assert.IsTrue(facilityType.FacilityDefaultLinearUnitSpecified);
                    Assert.IsTrue(facilityType.FacilityDefaultAreaUnitSpecified);
                    Assert.IsTrue(facilityType.FacilityDefaultVolumeUnitSpecified);                    
                    using (var fs = new StreamWriter(NewJsonFile))
                    {
                        Xbim.COBieLite.CoBieLiteHelper.WriteJson(fs, facilityType);
                        fs.Close();
                    }
                }
            }

we are not able to export the properties (IFCCOVERING, IFCROOF,IFCSTAIR,IFCMEMBER,IFCSITE,IFCDOOR,IFCPLATE) when we searching in IFC file many records are available. But after the JSON conversion above properties are missed.

Please help me on this. Kindly provide any c# code to convert IFC to JSON file (with exporting all properties without missing anything).

Thanks in advance

martin1cerny commented 3 years ago

COBie specification states that some element types should not be exported. Feel free to change the settings or the code.